![]() |
Gorgon Game Engine
|
The base class for compilers. More...
Public Member Functions | |
Base (Scope *scope) | |
virtual | ~Base () |
virtual unsigned | Compile (const std::string &input, unsigned long pline)=0 |
Asks the compiler to compile the given input. More... | |
virtual Base & | Duplicate (Scope *scope) const =0 |
virtual void | Finalize ()=0 |
Finalizes the compilation. More... | |
Scope & | GetScope () const |
Returns the scope that compiler will compile. More... | |
bool | HasScope () const |
Returns if this compiler is bound to a scope. More... | |
Public Attributes | |
std::vector< Instruction > | List |
The instructions that are compiled. More... | |
Protected Attributes | |
Scope * | scope |
The current scope the compiler is compiling, can be nullptr. More... | |
The base class for compilers.
|
virtual |
|
pure virtual |
Asks the compiler to compile the given input.
Returns the number of instructions generated from the code. Compiler is free to request additional input by returning zero. This does not necessarily mean there is no compilable source in the given input it may simply be an incomplete line. When there is no more input, caller should finish compilation by calling Finalize
Implemented in Programming, and Intermediate.
Implemented in Programming, and Intermediate.
|
pure virtual |
Finalizes the compilation.
Compiler may throw an error about missing constructs at this point.
Implemented in Programming, and Intermediate.
Scope& GetScope | ( | ) | const |
Returns the scope that compiler will compile.
References Base::scope.
bool HasScope | ( | ) | const |
Returns if this compiler is bound to a scope.
References Base::scope.
std::vector<Instruction> List |
The instructions that are compiled.
|
protected |
The current scope the compiler is compiling, can be nullptr.