New blog post!

I've been investigating out how various languages get away with not requiring semicolons.

I looked at 11 languages and found so many interesting cases I had to share!

https://terts.dev/blog/no-semicolons-needed/

#programming #roto

No Semicolons Needed | Terts Diepraam

@terts The biggest issue with comparing semicolon inference in existing languages:

Most ship with an absolutely half-assed implementation because it's an aspect of syntax that is rarely possible to fix after it shipped.

Sadly, it appears your article managed to include only languages with such half-assed implementations.

@soc I'd love to hear about the full-assed implementations! Which ones do you consider to be good?

@terts Look for any language that checks both the token before and the token after the newline to determine whether a semicolon should be inserted.

For instance in this list, have a look at Scala: https://pling.jondgoodwin.com/post/semicolon-inference/#scala

Semicolon Inference

@terts The token set approach can largely emulate the grammar-driven approach of the languages in your blog (by poorly configuring the tokens in the before/after set), but not the other way around.

@terts The best approach I found to figure out what needs to go into these before/after sets:

Imagine a hypothetical variant of your language where semicolons are required, then treat any difference between that language and your semicolon-inferred language as a bug in the inference rules.

That pretty much decides 98% of the "how should I actually parse this" ambiguities you might encounter, including the "binary operation split across newline gets treated as unary operator" issue.