lua/lua library

Classes

AssignMultiStmt
Like DeclMultiVar, multiple variables can be reassigned at once. Note that it is not a math expr and cannot be used to return assignments as values.
AssignStmt
Variables can be reassigned. This node encodes this operation. Note that it is not a math expr and cannot be used to return assignments as values.
AST
The entry node of any lua program. A program is a collection of stmts.
BinaryExpr
Any binary expression (lhs op rhs) is encoded by this node. op is the operator used on lhs and rhs expressions.
BooleanLiteral
BooleanLiteral.asTrue encodes the literal true. BooleanLiteral.asFalse encodes the literal false.
BreakStmt
Represents the keyword 'break' in lua.
DeclArg
This node tells the grammar how to compose a function's argument list.
DeclMultiVar
Lua supports multivariable assignment. Therefore it supports multivariable declarations. The values are determined at runtime and follow the specification here: https://www.lua.org/pil/5.1.html
DeclVar
This represents a variable declaration in lua. The variable name will be id. It may have initialization terms provided by init.
DoBlockStmt
Lua do-block grammar node.
Evaluator
A very simple LUA evaluator using a basic implementation of the standard runtime StdRuntime. Can be used whereever EvaluatorMixin is expected. If someone wants to get started using this library this is what they want to use.
ForIterLoopStmt
The generic variant of lua's for-loop control structure. Unlike the step-wise variant, this evaluates exprs and stores them in vars following the multi-variable assignment rules in this language. That is, if there are too many returned results and not enough vars, then the remaining vars will be nil.
ForLoopStmt
The step-wise variant of lua's for-loop control structure.
FuncExpr
Function declarations can be assigned to variables and are therefore math expressions.
GotoLabelStmt
Represents labels which goto statements use.
GotoStmt
Represents the 'goto' keyword in lua. https://www.lua.org/manual/5.5/manual.html#3.3.4
GroupExpr
Group expressions are expressions wrapped in parents (...).
IfStmt
Represents a linked list of conditional statements. Consider the chain if -> elif -> elif -> else. Therefore else statements are IfStmt without an expr. See IfStmt.terminalElse constructor.
KeyValStmt
For convenience, table {key, value} expressions are encoded as this node.
MathExpr
MemoryAccess
Memory access node encodes which operator op was used, the callee resolved on the left-hand side, the type for convenience, and the input args.
NilLiteral
Nil literals are encoded as this node.
NotExpr
In Lua, the not operator is used to negate a boolean value, meaning it converts true to false and false to true.
NumberLiteral
Integers and real literals are encoded as this node.
RawExpr
Represents identifiers in lua. Anything that is not a keyword or an expression is likely an identifier like a variable name or table fields. The spec defines labels as identifiers but those are encoded in this lib by GotoLabelStmt.
RepeatUntilLoopStmt
Similar to a while-loop but conditional expression untilExpr is the termination condition.
ReturnStmt
Represents the keyword 'return' in lua. This keyword can return whole expressions comma separated. See values.
SelfExpr
The token for 'self'. While not a keyword in lua, it is encoded as one in this lib for convenience.
StdRuntime
Implement the standard runtime. Initialize the libraries we are interested in using.
StdRuntimeResults
Standard runtime results collects no special information.
Stmt
Base grammar node.
StringLiteral
String literals are encoded as this node.
TableLiteral
Table literal expressions {...} are encoded by this node.
UnaryExpr
Any tightly bound unary prefix is encoded by this node.
Visitor<T>
This abstraction visits every node class variant. Visitors are the staple of this runtime implementation. They can be used to implement semantic checks as well as implement runtimes. Additionally custom visitors c an walk the AST of a program and generate lua bytecode.
WhileLoopStmt
Lua while-do loop grammar node.

Enums

MemoryAccessType
Memory access on a variable is in the form of

Mixins

EvaluatorMixin
Enables any class inheritting BaseRuntime to be made available as a public-facing runtime API.