struct
InterpreterThis is in a class so we can track some state. E.g. including lua files or do some caching.
However most of the methods are basically pure functions and they all take the current node they are visiting and the current environment.
The visit_
methods evaluate a part of the lua AST and delegate smaller parts to other visit_
methods. The methods return an EvalResult which can be combined with other EvalResults to easily track source changes (etc.). The values of expressions are all Vallists because some expressions can return more than one value (e.g. a function call).
visit_block
and visit_block_with_local_env
are helper methods to create a new scope (for local variables).
Additionally there are some trace_
methods to help in debugging and logging. And NodeTracer to trace entering and exiting the visit_
methods.