lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]




2010/12/6 steve donovan <steve.j.donovan@gmail.com>
On Mon, Dec 6, 2010 at 8:20 AM, starwing <weasley.wx@gmail.com> wrote:
> local t = {1 2 3 4}
> just read a expr() and a optional comma/semi-colon is not diffcult in
> grammar.

I bet you there are ambiguous cases, Lisp gets away with it because it
has no syntax ;)

yes, there are ambiguous cases of couse. e.g. 
{ a = f (g)(h) }

is means:
{a = f; (g)(h);}

or:
{a = f(g)(h); }

BUT, the lua language itself has these ambiguous case, either. because in lua, "expr" is a kind of statement, and you can omit the semi-colon between statement, so if we omit the semi-colon between table element in a table constructor, we can parse the table just like to parse a lua program(only has "expr" as "statement"). so the ambiguous is not the problem -- just resolve them as lua resolve them.

the key is, can mostly people accept this semantics? 

> just change the parser to support it, maybe I can work a patch out. but I
> just want to know anybody interest it :-)

The word 'just' is one of the most terrifying words in the English
language for programmers.

yes! but we can just have a try :-)
 
But it would be an interesting patch...

and i will try it. it will help me to understand the parser of lua, too. 

steve d.