GCompilerPriv Class Reference

Scripting language compiler implementation. More...

Inherits GCompileTools, and GScriptUtils.

List of all members.

Public Member Functions

bool Asm0 (int Tok, uint8 Op)
 Assemble a zero argument instruction.
bool Asm1 (int Tok, uint8 Op, GVarRef a)
 Assemble one arg instruction.
bool Asm2 (int Tok, uint8 Op, GVarRef a, GVarRef b)
 Assemble two arg instruction.
bool Asm3 (int Tok, uint8 Op, GVarRef a, GVarRef b, GVarRef c)
 Assemble three arg instruction.
bool Asm4 (int Tok, uint8 Op, GVarRef a, GVarRef b, GVarRef c, GVarRef d)
 Assemble four arg instruction.
bool Lex (char *Source, char *FileName)
 Convert the source from one big string into an array of tokens.
void AllocNull (GVarRef &r)
 Create a null var ref.
void AllocConst (GVarRef &r, double d)
 Allocate a constant double.
void AllocConst (GVarRef &r, int i)
 Allocate a constant int.
void AllocConst (GVarRef &r, char *s, int len=-1)
 Allocate a constant string.
void AllocConst (GVarRef &r, char16 *s, int len)
 Allocate a constant wide string.
GVarRef FindVariable (GVariant &Name, bool Create)
 Find a variable by name, creating it if needed.
bool AssignVarRef (Node &n, GVarRef &Value)
 Build asm to assign a var ref.
bool TokenToVarRef (Node &n)
 Convert a token stream to a var ref.
bool Expression (int &Cur, GArray< Node > &n, int Depth=0)
 Parse expression into a node tree.
bool AllocReg (GVarRef &r, char *file, int line)
 Allocate a register (must be mirrored with DeallocReg).
bool DeallocReg (GVarRef &r)
 Deallocate a register.
int RegAllocCount ()
 Count allocated registers.
bool AsmExpression (GVarRef *Result, GArray< Node > &n, int Depth=0)
 Creates byte code to evaluate an expression.
bool DoExpression (int &Cur, GVarRef *Result)
 Parses and assembles an expression.
bool DoStatements (int &Cur, bool MoreThanOne=true)
 Parses statements.
bool DoIf (int &Cur)
 Parses if/else if/else construct.
bool DoWhile (int &Cur)
 Parses while construct.
bool DoFor (int &Cur)
 Parses for construct.
bool DoReturn (int &Cur)
 Compiles return construct.
bool DoStruct (int &Cur)
 Compiles struct construct.
bool Compile ()
 Compiler entry point.


Detailed Description

Scripting language compiler implementation.

Member Function Documentation

bool GCompilerPriv::AsmExpression ( GVarRef Result,
GArray< Node > &  n,
int  Depth = 0 
) [inline]

Creates byte code to evaluate an expression.

Parameters:
Result  Where the result got stored
n  The nodes to create code for
Depth  The depth of recursion

References AllocReg(), Asm1(), Asm2(), Asm3(), AssignVarRef(), DeallocReg(), GArray< Type >::DeleteAt(), FindVariable(), GV_STRING, GArray< Type >::Length(), GVariant::Str(), GVariant::String, TokenToVarRef(), GVariant::Type, GVarRef::Valid(), and GVariant::Value.

Referenced by AssignVarRef(), DoExpression(), DoReturn(), and TokenToVarRef().


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

Generated on Wed Dec 1 15:41:02 2010 for Lgi by  doxygen 1.5.7.1