|
Actually that's wrong. The grammar is very, very close to being an LALR(1) grammar. I only needed to change the rule:
stat -> functioncall
to
stat -> prefixexp
and it went straight through a yecc, which is a yacc-like parser generator for Erlang, without a hitch. Without the change you get reduce-reduce conflicts. Then you just needed to add a check that the production WAS a function call otherwise generate an error and everything worked. Even the optional semicolon was easy to handle. So the grammar is very regular.
This does make it easier if you want to make your own Lua implementation or Lua source code tools.
Robert