lua-users home
lua-l archive

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


> The parsing and code generation of assignment statements is IMO one of
> the trickiest aspects of Lua, another being the handling of multiple
> return values. Lua solves the l-value / r-value dilemma by deferring
> the resolution of these expressions until the expression is used -
> hence the VINDEXED expression type can end up being a GET or a PUT.
> 
> The parsing of assignments follows a strange course. I believe the
> vars on the left of '=' are parsed recursively first, then at the top
> of recursion, the expression list to the right of '=' is parsed, and
> then during the unwind, the store instructions get generated. Please
> correct me if I am wrong.

Note that all this complexity is mainly due to LL(k) parsing and the
absence of an AST. With an LR parser and/or an AST, the implementation
would be able to follow the grammar almost literally. (What parsing
technique does your new implementation use?)

-- Roberto