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!
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!
@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.
@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
@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.