void (*genCPL)(SyntaxTree*, String* , CPL3BlockStack &)
-
Used as an alternative to the subclass-based generateCode function
void (*genAS)(SyntaxTree*, String* , CPL3BlockStack &)
-
Used as an alternative to the subclass based secondary function
void setLine(int l)
-
Line, column setting routines
SyntaxTree(String* type, Vector* branches)
-
Constructs a new syntax tree with a specified type and branches.
- Parameters:
- - type the type of the tree.
- branches the list of branches.
- type the type of the tree.
- branches the list of branches.
void setType(String* type)
-
Sets the type of the tree.
Sets the type of the tree.
- Parameters:
- - type the type of the tree.
- type the type of the tree.
String* getType()
-
Gets the type of the tree
Gets the type of the tree
- Returns:
- the type of the tree.
the type of the tree.
void addBranch(SyntaxTree_Object* branch)
-
Adds a branch to the end of the branches list.
Adds a branch to the end of the branches list.
- Parameters:
- branch - the branch to be added.
branch - the branch to be added.
SyntaxTree_Object* getBranch(int number)
-
Returns a specified branch.
Returns a specified branch.
- Parameters:
- number - the branch number, base index 0.
number - the branch number.
- Returns:
- the branch value.
the branch value.
void serialize(ostream &output)
-
Outputs a string with the serialized form of the entire tree.
Returns a string with the serialized form of the entire tree.
void toString(ostream &output)
-
Returns a string representation of the tree (without formatting).
Returns a string representation of the tree (without formatting).
void generateCPL(String* data, CPL3BlockStack &blocks)
-
Calls the codeGenerationFunction
Calls the codeGenerationFunction
void generateAssembly(String* data, CPL3BlockStack &blocks)
-
Calls the secondaryFunction.
Calls the secondaryFunction.
- Parameters:
- - data the data to be passed and/or returned from the function.
- data the data to be passed and/or returned from the function.
unsigned int size()
-
Function to return the size of the vector (ie. the number of branches)
in the SyntaxTree
Function to return the size of the vector (ie. the number of branches)
in the SyntaxTree