lua-users home
lua-l archive

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


> That's why I think it is annoying to document the BNF differing than the
> actual implementation. There is no such problem in the real parser, and
> there should be no need to invent another solution.

The purpose of the specification is to specify, not to give you a ready
implementation for one particular tool. In particular, the grammar in
the implementation is far from good for a tool like yacc. Moreover, in
my opinion, the grammar in the real parser is more difficult to read,
because sentences that we tend to think as a block, such as 'a:f(x)', are
broken in a kind of CPS. Finally, the real parser must rely on semantics
analysis to reject things like these:

  f(x).a;
  f(x) = a;

-- Roberto