[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: Lua has reached a local optimum
- From: Pierre Chapuis <catwell@...>
- Date: Fri, 06 Jul 2018 09:58:42 +0200
On Fri, Jul 6, 2018, at 05:18, Gé Weijers wrote:
The language BCPL used a fairly simple strategy to detect statement ends:
Let E be the set of symbols that can end a statement, and S be the set of symbols that can start a statement. If the lexical analyzer sees a symbol in E followed by a newline, follow by a symbol in S it inserts a semicolon between them.
For Lua E would include identifiers, literals and all the closing brackets, and S would include identifiers, literals and opening brackets.
It would be interesting to see whether this could be made to work well for Lua. In terms of LR parsing, the parser would resolve these shift-reduce ambiguities with a shift, except when a newline occurs.
This would be a pretty big change to the language, since as of today newlines have no special meaning in Lua.