Gorgon Game Engine
Base Class Referenceabstract

The base class for compilers. More...

Inheritance diagram for Base:
[legend]

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 BaseDuplicate (Scope *scope) const =0
 
virtual void Finalize ()=0
 Finalizes the compilation. More...
 
ScopeGetScope () 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< InstructionList
 The instructions that are compiled. More...
 

Protected Attributes

Scopescope
 The current scope the compiler is compiling, can be nullptr. More...
 

Detailed Description

The base class for compilers.

Constructor & Destructor Documentation

◆ Base()

Base ( Scope scope)

◆ ~Base()

virtual ~Base ( )
virtual

Member Function Documentation

◆ Compile()

virtual unsigned Compile ( const std::string &  input,
unsigned long  pline 
)
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.

◆ Duplicate()

virtual Base& Duplicate ( Scope scope) const
pure virtual

Implemented in Programming, and Intermediate.

◆ Finalize()

virtual void Finalize ( )
pure virtual

Finalizes the compilation.

Compiler may throw an error about missing constructs at this point.

Implemented in Programming, and Intermediate.

◆ GetScope()

Scope& GetScope ( ) const

Returns the scope that compiler will compile.

References Base::scope.

◆ HasScope()

bool HasScope ( ) const

Returns if this compiler is bound to a scope.

References Base::scope.

Member Data Documentation

◆ List

std::vector<Instruction> List

The instructions that are compiled.

◆ scope

Scope* scope
protected

The current scope the compiler is compiling, can be nullptr.


The documentation for this class was generated from the following file: