lua-users home
lua-l archive

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


Hi Jason,

2013. 10. 27. 오후 6:06에 "Jason Nielsen" <drjdnielsen@gmail.com>님이 작성:
>
> I've been looking at the EBNF in the manual and I'm a bit confused by the following two rules:
>
> var ::=  Name | prefixexp ‘[’ exp ‘]’ | prefixexp ‘.’ Name
>
> prefixexp ::= var | functioncall | ‘(’ exp ‘)’
>
> if you expand this out you get var on the right hand side of the var rule definition.  I'm not a CS guru so perhaps I'm misunderstanding EBNF notation.

This is called left-recursion and is incompatible with lpeg in a straight port of the grammar. See [1] for a solution.

[1] http://lua-users.org/lists/lua-l/2010-12/msg00699.html

- Patrick