This page contains a sketch of the SMOL implementation internals.
Parsing and Typechecking Program Flow¶
SMOL input files are parsed via antlr; the antlr grammar can be found in src/main/antlr/While.g4.
Parsing, typechecking and preparation to run a SMOL program are done by the method REPL.initInterpreter, which calls methods according to Figure Parsing Flow.
Executing a smol program is controlled by the REPL class. An
Interpreter object keeps track of the execution state, which consists of a stack of StackEntry objects and a GlobalMemory instance, which in turn maps object names to their Memory.
A single statement is executed by the method Interpreter.makeStep.