MysoreScript
|
#include <interpreter.hh>
Public Member Functions | |
void | pushSymbols (SymbolTable &s) |
Push a new symbol table on top of the stack. More... | |
void | popSymbols () |
Pop the top symbol table off the stack. More... | |
Obj * | lookupSymbol (const std::string &name) |
Look up a symbol, walking up the symbol table stack until it's found. More... | |
void | setSymbol (const std::string &name, Obj *val) |
Set the address where the variable corresponding to a particular symbol is stored. More... | |
void | setSymbol (const std::string &name, Obj val) |
Set a symbol to the specified value. More... | |
Public Attributes | |
SymbolTable | globalSymbols |
Global symbols. More... | |
Value | retVal = nullptr |
The value currently being returned, if there is one. More... | |
bool | isReturning = false |
Are we currently returning? More... | |
Definition at line 104 of file interpreter.hh.
Obj * Interpreter::Context::lookupSymbol | ( | const std::string & | name | ) |
Look up a symbol, walking up the symbol table stack until it's found.
Definition at line 321 of file interpreter.cc.
|
inline |
Pop the top symbol table off the stack.
Definition at line 140 of file interpreter.hh.
|
inline |
Push a new symbol table on top of the stack.
Definition at line 136 of file interpreter.hh.
void Interpreter::Context::setSymbol | ( | const std::string & | name, |
Obj * | val | ||
) |
Set the address where the variable corresponding to a particular symbol is stored.
void Interpreter::Context::setSymbol | ( | const std::string & | name, |
Obj | val | ||
) |
Set a symbol to the specified value.
This will allocate global storage for the symbol if it is not already allocated.
SymbolTable Interpreter::Context::globalSymbols |
Global symbols.
These all refer to values in the globals
list.
Definition at line 121 of file interpreter.hh.
bool Interpreter::Context::isReturning = false |
Are we currently returning?
Definition at line 132 of file interpreter.hh.
Value Interpreter::Context::retVal = nullptr |
The value currently being returned, if there is one.
When a return
statement is interpreted, it sets this value and returns. We then don't interpret any more statements until we come to the end of the current function and return the value stored here.
Definition at line 128 of file interpreter.hh.