Structures and functions for interpreting a parse tree. More...
Data Structures | |
| struct | ReturnObject |
| Stores a return state. More... | |
| struct | ScopeObject |
| Stores the variables in a particular scope. More... | |
| union | ValueData |
| Stores the data associated with a ValueObject structure. More... | |
| struct | ValueObject |
| Stores a value. More... | |
Defines | |
| #define | getFloat(value) (value->data.f) |
| Gets the floating point data associated with a ValueObject structure. | |
| #define | getInteger(value) (value->data.i) |
| Gets the integer data associated with a ValueObject structure. | |
| #define | getString(value) (value->data.s) |
| Gets the string data associated with a ValueObject structure. | |
| #define | P(value) (value->semaphore--) |
| Decrements the semaphore of a ValueObject structure. | |
| #define | V(value) (value->semaphore++) |
| Increments the semaphore of a ValueObject structure. | |
Enumerations | |
| enum | ReturnType { RT_DEFAULT, RT_BREAK, RT_RETURN } |
Denotes the type of return encountered. More... | |
| enum | ValueType { VT_INTEGER, VT_FLOAT, VT_BOOLEAN, VT_STRING, VT_NIL } |
Denotes the type of a value. More... | |
Functions | |
| ValueObject * | castBooleanExplicit (ValueObject *, ScopeObject *) |
| Casts the contents of a ValueObject structure to boolean type in an explicit context. | |
| ValueObject * | castBooleanImplicit (ValueObject *, ScopeObject *) |
| Casts the contents of a ValueObject structure to boolean type in an implicit context. | |
| ValueObject * | castFloatExplicit (ValueObject *, ScopeObject *) |
| Casts the contents of a ValueObject structure to floating point decimal type in an explicit context. | |
| ValueObject * | castFloatImplicit (ValueObject *, ScopeObject *) |
| Casts the contents of a ValueObject structure to floating point decimal type in an implicit context. | |
| ValueObject * | castIntegerExplicit (ValueObject *, ScopeObject *) |
| Casts the contents of a ValueObject structure to integer type in an explicit context. | |
| ValueObject * | castIntegerImplicit (ValueObject *, ScopeObject *) |
| Casts the contents of a ValueObject structure to integer type in an implicit context. | |
| ValueObject * | castStringExplicit (ValueObject *, ScopeObject *) |
| Casts the contents of a ValueObject structure to string type in an explicit context. | |
| ValueObject * | castStringImplicit (ValueObject *, ScopeObject *) |
| Casts the contents of a ValueObject structure to string type in an implicit context. | |
| ValueObject * | copyValueObject (ValueObject *) |
| Copies a ValueObject structure. | |
| ValueObject * | createBooleanValueObject (int) |
| Creates a boolean type ValueObject structure. | |
| ValueObject * | createFloatValueObject (float) |
| Creates a floating point data decimal type ValueObject structure. | |
| ValueObject * | createIntegerValueObject (int) |
| Creates an integer type ValueObject structure. | |
| ValueObject * | createNilValueObject (void) |
| Creates a nil type ValueObject structure. | |
| ReturnObject * | createReturnObject (ReturnType, ValueObject *) |
| Creates a ReturnObject structure. | |
| ScopeObject * | createScopeObject (ScopeObject *) |
| Creates a ScopeObject structure. | |
| ValueObject * | createScopeValue (ScopeObject *, IdentifierNode *) |
| Creates a new, nil, named ValueObject structure in a ScopeObject structure. | |
| char * | createString (char *) |
| Creates a string by copying the contents of another string. | |
| ValueObject * | createStringValueObject (char *) |
| Creates a string type ValueObject structure. | |
| void | deleteReturnObject (ReturnObject *) |
| Deletes a ReturnObject structure. | |
| void | deleteScopeObject (ScopeObject *) |
| Deletes a ScopeObject structure. | |
| void | deleteValueObject (ValueObject *) |
| Deletes a ValueObject structure. | |
| ValueObject * | getLocalScopeValue (ScopeObject *, IdentifierNode *) |
| Retrieves a named ValueObject structure from a ScopeObject structure without traversing through its parents. | |
| ValueObject * | getScopeValue (ScopeObject *, IdentifierNode *) |
| Retrieves a named ValueObject structure from a ScopeObject structure, traversing its parents if necessary. | |
| ValueObject * | interpretArithOpExprNode (OpExprNode *, ScopeObject *) |
| Interprets an arithmetic operation expression. | |
| ReturnObject * | interpretAssignmentStmtNode (StmtNode *, ScopeObject *) |
| Interprets an assignment statement. | |
| ReturnObject * | interpretBlockNode (BlockNode *, ScopeObject *) |
| Interprets the contents of a BlockNode structure. | |
| ValueObject * | interpretBoolOpExprNode (OpExprNode *, ScopeObject *) |
| Interprets a boolean operation expression. | |
| ReturnObject * | interpretBreakStmtNode (StmtNode *, ScopeObject *) |
| Interprets a break statement. | |
| ValueObject * | interpretCastExprNode (ExprNode *, ScopeObject *) |
| Interprets a cast expression. | |
| ReturnObject * | interpretCastStmtNode (StmtNode *, ScopeObject *) |
| Interprets a cast statement. | |
| ValueObject * | interpretConcatOpExprNode (OpExprNode *, ScopeObject *) |
| Interprets a concatenation operation expression. | |
| ValueObject * | interpretConstantExprNode (ExprNode *, ScopeObject *) |
| Interprets a constant expression. | |
| ReturnObject * | interpretDeclarationStmtNode (StmtNode *, ScopeObject *) |
| Interprets a declaration statement. | |
| ValueObject * | interpretEqualityOpExprNode (OpExprNode *, ScopeObject *) |
| Interprets an equality operation expression. | |
| ValueObject * | interpretExprNode (ExprNode *, ScopeObject *) |
| Interprets the contents of an ExprNode structure. | |
| ReturnObject * | interpretExprStmtNode (StmtNode *, ScopeObject *) |
| Interprets an expression statement. | |
| ValueObject * | interpretFuncCallExprNode (ExprNode *, ScopeObject *) |
| Interprets a function call expression. | |
| ReturnObject * | interpretFuncDefStmtNode (StmtNode *, ScopeObject *) |
| Interprets a function definition statement. | |
| ValueObject * | interpretIdentifierExprNode (ExprNode *, ScopeObject *) |
| Interprets an identifier expression. | |
| ReturnObject * | interpretIfThenElseStmtNode (StmtNode *, ScopeObject *) |
| Interprets an if/then/else statement. | |
| ValueObject * | interpretImpVarExprNode (ExprNode *, ScopeObject *) |
| Interprets an implicit variable expression. | |
| ReturnObject * | interpretInputStmtNode (StmtNode *, ScopeObject *) |
| Interprets an input statement. | |
| ReturnObject * | interpretLoopStmtNode (StmtNode *, ScopeObject *) |
| Interprets a loop statement. | |
| int | interpretMainNode (MainNode *) |
| Interprets the contents of a MainNode structure. | |
| ValueObject * | interpretNotOpExprNode (OpExprNode *, ScopeObject *) |
| Interprets a logical NOT operation expression. | |
| ValueObject * | interpretOpExprNode (ExprNode *, ScopeObject *) |
| Interprets an operation expression. | |
| ReturnObject * | interpretPrintStmtNode (StmtNode *, ScopeObject *) |
| Interprets a print statement. | |
| ReturnObject * | interpretReturnStmtNode (StmtNode *, ScopeObject *) |
| Interprets a return statement. | |
| ReturnObject * | interpretStmtNode (StmtNode *, ScopeObject *) |
| Interprets the contents of a StmtNode structure. | |
| ReturnObject * | interpretStmtNodeList (StmtNodeList *, ScopeObject *) |
| Interprets the contents of a StmtNodeList structure. | |
| ReturnObject * | interpretSwitchStmtNode (StmtNode *, ScopeObject *) |
| Interprets a switch statement. | |
| unsigned int | isHexString (const char *) |
| Checks if a string of characters follows the format for a hexadecimal number. | |
| unsigned int | isNumString (const char *) |
| Checks if a string of characters follows the format for a number. | |
| ValueObject * | opAddFloatFloat (ValueObject *, ValueObject *) |
| Adds two floats. | |
| ValueObject * | opAddFloatInteger (ValueObject *, ValueObject *) |
| Adds a float and an integer. | |
| ValueObject * | opAddIntegerFloat (ValueObject *, ValueObject *) |
| Adds an integer and a float. | |
| ValueObject * | opAddIntegerInteger (ValueObject *, ValueObject *) |
| Adds two integers. | |
| ValueObject * | opDivFloatFloat (ValueObject *, ValueObject *) |
| Divides two floats. | |
| ValueObject * | opDivFloatInteger (ValueObject *, ValueObject *) |
| Divides a float and an integer. | |
| ValueObject * | opDivIntegerFloat (ValueObject *, ValueObject *) |
| Divides an integer and a float. | |
| ValueObject * | opDivIntegerInteger (ValueObject *, ValueObject *) |
| Divides two integers. | |
| ValueObject * | opEqBooleanBoolean (ValueObject *, ValueObject *) |
| Tests if two boolean values are equal. | |
| ValueObject * | opEqFloatFloat (ValueObject *, ValueObject *) |
| Tests if two floats are equal. | |
| ValueObject * | opEqFloatInteger (ValueObject *, ValueObject *) |
| Tests if a float and an integer are equal. | |
| ValueObject * | opEqIntegerFloat (ValueObject *, ValueObject *) |
| Tests if an integer and a float are equal. | |
| ValueObject * | opEqIntegerInteger (ValueObject *, ValueObject *) |
| Tests if two integers are equal. | |
| ValueObject * | opEqNilNil (ValueObject *, ValueObject *) |
| Tests if two nil values are equal. | |
| ValueObject * | opEqStringString (ValueObject *, ValueObject *) |
| Tests if two strings are equal. | |
| ValueObject * | opMaxFloatFloat (ValueObject *, ValueObject *) |
| Finds the maximum of two floats. | |
| ValueObject * | opMaxFloatInteger (ValueObject *, ValueObject *) |
| Finds the maximum of a float and an integer. | |
| ValueObject * | opMaxIntegerFloat (ValueObject *, ValueObject *) |
| Finds the maximum of an integer and a float. | |
| ValueObject * | opMaxIntegerInteger (ValueObject *, ValueObject *) |
| Finds the maximum of two integers. | |
| ValueObject * | opMinFloatFloat (ValueObject *, ValueObject *) |
| Finds the minimum of two floats. | |
| ValueObject * | opMinFloatInteger (ValueObject *, ValueObject *) |
| Finds the minimum of a float and an integer. | |
| ValueObject * | opMinIntegerFloat (ValueObject *, ValueObject *) |
| Finds the minimum of an integer and a float. | |
| ValueObject * | opMinIntegerInteger (ValueObject *, ValueObject *) |
| Finds the minimum of two integers. | |
| ValueObject * | opModFloatFloat (ValueObject *, ValueObject *) |
| Calculates the modulus of two floats. | |
| ValueObject * | opModFloatInteger (ValueObject *, ValueObject *) |
| Calculates the modulus of a float and an integer. | |
| ValueObject * | opModIntegerFloat (ValueObject *, ValueObject *) |
| Calculates the modulus of an integer and a float. | |
| ValueObject * | opModIntegerInteger (ValueObject *, ValueObject *) |
| Calculates the modulus of two integers. | |
| ValueObject * | opMultFloatFloat (ValueObject *, ValueObject *) |
| Multiplies two floats. | |
| ValueObject * | opMultFloatInteger (ValueObject *, ValueObject *) |
| Multiplies a float and an integer. | |
| ValueObject * | opMultIntegerFloat (ValueObject *, ValueObject *) |
| Multiplies an integer and a float. | |
| ValueObject * | opMultIntegerInteger (ValueObject *, ValueObject *) |
| Multiplies two integers. | |
| ValueObject * | opNeqBooleanBoolean (ValueObject *, ValueObject *) |
| Tests if two boolean values are not equal. | |
| ValueObject * | opNeqFloatFloat (ValueObject *, ValueObject *) |
| Tests if two floats are not equal. | |
| ValueObject * | opNeqFloatInteger (ValueObject *, ValueObject *) |
| Tests if a float and an integer are not equal. | |
| ValueObject * | opNeqIntegerFloat (ValueObject *, ValueObject *) |
| Tests if an integer and a float are not equal. | |
| ValueObject * | opNeqIntegerInteger (ValueObject *, ValueObject *) |
| Tests if two integers are not equal. | |
| ValueObject * | opNeqNilNil (ValueObject *, ValueObject *) |
| Tests if two nil values are not equal. | |
| ValueObject * | opNeqStringString (ValueObject *, ValueObject *) |
| Tests if two strings are not equal. | |
| ValueObject * | opSubFloatFloat (ValueObject *, ValueObject *) |
| Subtracts two floats. | |
| ValueObject * | opSubFloatInteger (ValueObject *, ValueObject *) |
| Subtracts a float and an integer. | |
| ValueObject * | opSubIntegerFloat (ValueObject *, ValueObject *) |
| Subtracts an integer and a float. | |
| ValueObject * | opSubIntegerInteger (ValueObject *, ValueObject *) |
| Subtracts two integers. | |
| ValueObject * | updateScopeValue (ScopeObject *, IdentifierNode *, ValueObject *) |
| Updates a ValueObject structure named by an IdentifierNode structure in a ScopeObject structure. | |
Structures and functions for interpreting a parse tree.
The interpreter traverses a parse tree in a depth-first manner, interpreting each node it reaches along the way. This is the last stage of the processing of a source code file.
| #define getFloat | ( | value | ) | (value->data.f) |
Gets the floating point data associated with a ValueObject structure.
| #define getInteger | ( | value | ) | (value->data.i) |
Gets the integer data associated with a ValueObject structure.
| #define getString | ( | value | ) | (value->data.s) |
Gets the string data associated with a ValueObject structure.
| #define P | ( | value | ) | (value->semaphore--) |
Decrements the semaphore of a ValueObject structure.
| #define V | ( | value | ) | (value->semaphore++) |
Increments the semaphore of a ValueObject structure.
| enum ReturnType |
Denotes the type of return encountered.
| RT_DEFAULT |
A block of code returned after evaluating all of its statements. |
| RT_BREAK |
A block of code within a LoopStmtNode or SwitchStmtNode returned via a break statement. |
| RT_RETURN |
A block of code within a FuncDefStmtNode called by a FuncCallExprNode returned (either with or without a value). |
| enum ValueType |
| ValueObject* castBooleanExplicit | ( | ValueObject * | node, | |
| ScopeObject * | scope | |||
| ) |
Casts the contents of a ValueObject structure to boolean type in an explicit context.
Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.
| NULL | An error occurred while casting. |
| [in] | node | The ValueObject structure to cast. |
| [in] | scope | The ScopeObject structure to use for variable interpolation. |
| ValueObject* castBooleanImplicit | ( | ValueObject * | node, | |
| ScopeObject * | scope | |||
| ) |
Casts the contents of a ValueObject structure to boolean type in an implicit context.
Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.
| NULL | An error occurred while casting. |
| [in] | node | The ValueObject structure to cast. |
| [in] | scope | The ScopeObject structure to use for variable interpolation. |
| ValueObject* castFloatExplicit | ( | ValueObject * | node, | |
| ScopeObject * | scope | |||
| ) |
Casts the contents of a ValueObject structure to floating point decimal type in an explicit context.
Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.
| NULL | An error occurred while casting. |
| [in] | node | The ValueObject structure to cast. |
| [in] | scope | The ScopeObject structure to use for variable interpolation. |
| ValueObject* castFloatImplicit | ( | ValueObject * | node, | |
| ScopeObject * | scope | |||
| ) |
Casts the contents of a ValueObject structure to floating point decimal type in an implicit context.
Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.
| NULL | An error occurred while casting. |
| [in] | node | The ValueObject structure to cast. |
| [in] | scope | The ScopeObject structure to use for variable interpolation. |
| ValueObject* castIntegerExplicit | ( | ValueObject * | node, | |
| ScopeObject * | scope | |||
| ) |
Casts the contents of a ValueObject structure to integer type in an explicit context.
Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.
| NULL | An error occurred while casting. |
| [in] | node | The ValueObject structure to cast. |
| [in] | scope | The ScopeObject structure to use for variable interpolation. |
| ValueObject* castIntegerImplicit | ( | ValueObject * | node, | |
| ScopeObject * | scope | |||
| ) |
Casts the contents of a ValueObject structure to integer type in an implicit context.
Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.
| NULL | An error occurred while casting. |
| [in] | node | The ValueObject structure to cast. |
| [in] | scope | The ScopeObject structure to use for variable interpolation. |
| ValueObject* castStringExplicit | ( | ValueObject * | node, | |
| ScopeObject * | scope | |||
| ) |
Casts the contents of a ValueObject structure to string type in an explicit context.
Casting is not done to directly the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.
| NULL | An error occurred while casting. |
| [in] | node | The ValueObject structure to cast. |
| [in] | scope | The ScopeObject structure to use for variable interpolation. |
| ValueObject* castStringImplicit | ( | ValueObject * | node, | |
| ScopeObject * | scope | |||
| ) |
Casts the contents of a ValueObject structure to string type in an implicit context.
Casting is not done directly to the ValueObject structure pointed to by node, instead, it is performed on a copy of that structure, which is what is returned.
| NULL | An error occurred while casting. |
| [in] | node | The ValueObject structure to cast. |
| [in] | scope | The ScopeObject structure to use for variable interpolation. |
| ValueObject* copyValueObject | ( | ValueObject * | value | ) |
Copies a ValueObject structure.
| NULL | The type of value is unknown. |
| [in,out] | value | The ValueObject structure to create a copy of. |
| ValueObject* createBooleanValueObject | ( | int | data | ) |
Creates a boolean type ValueObject structure.
0 if data equals 0 and 1 otherwise.| NULL | malloc was unable to allocate memory. |
| [in] | data | The boolean data to store. |
| ValueObject* createFloatValueObject | ( | float | data | ) |
Creates a floating point data decimal type ValueObject structure.
| NULL | malloc was unable to allocate memory. |
| [in] | data | The floating point data to store. |
| ValueObject* createIntegerValueObject | ( | int | data | ) |
Creates an integer type ValueObject structure.
| NULL | malloc was unable to allocate memory. |
| [in] | data | The integer data to store. |
| ValueObject* createNilValueObject | ( | void | ) |
Creates a nil type ValueObject structure.
| NULL | malloc was unable to allocate memory. |
| ReturnObject* createReturnObject | ( | ReturnType | type, | |
| ValueObject * | value | |||
| ) |
Creates a ReturnObject structure.
| NULL | malloc was unable to allocate memory. |
| [in] | type | The type of return encountered. |
| [in] | value | A pointer to the ValueObject structure specifying the return value (optional, NULL if unused). |
| ScopeObject* createScopeObject | ( | ScopeObject * | parent | ) |
Creates a ScopeObject structure.
NULL if creating the root parent.| NULL | malloc was unable to allocate memory. |
| [in] | parent | A pointer to the parent ScopeObject. |
| ValueObject* createScopeValue | ( | ScopeObject * | scope, | |
| IdentifierNode * | target | |||
| ) |
Creates a new, nil, named ValueObject structure in a ScopeObject structure.
| NULL | realloc was unable to allocate memory. |
| [in,out] | scope | The ScopeObject structure to add a value to. |
| [in] | target | The name of the value to add. |
| char* createString | ( | char * | data | ) |
Creates a string by copying the contents of another string.
| NULL | malloc was unable to allocate memory. |
| [in] | data | A pointer to the string data to store. |
| ValueObject* createStringValueObject | ( | char * | data | ) |
Creates a string type ValueObject structure.
| NULL | malloc was unable to allocate memory. |
| [in] | data | The string data to store. |
| void deleteReturnObject | ( | ReturnObject * | object | ) |
Deletes a ReturnObject structure.
| [in,out] | object | The ReturnObject structure to be deleted. |
| void deleteScopeObject | ( | ScopeObject * | scope | ) |
Deletes a ScopeObject structure.
| [in,out] | scope | The ScopeObject structure to delete. |
| void deleteValueObject | ( | ValueObject * | value | ) |
Deletes a ValueObject structure.
| [in,out] | value | A pointer to the ValueObject structure to be deleted. |
| ValueObject* getLocalScopeValue | ( | ScopeObject * | scope, | |
| IdentifierNode * | target | |||
| ) |
Retrieves a named ValueObject structure from a ScopeObject structure without traversing through its parents.
| NULL | target could not be found in scope. |
| [in] | scope | The ScopeObject structure to check. |
| [in] | target | The name of the value to find. |
| ValueObject* getScopeValue | ( | ScopeObject * | scope, | |
| IdentifierNode * | target | |||
| ) |
Retrieves a named ValueObject structure from a ScopeObject structure, traversing its parents if necessary.
| NULL | target could not be found in scope. |
| [in] | scope | The ScopeObject structure to check. |
| [in] | target | The name of the value to find. |
| ValueObject* interpretArithOpExprNode | ( | OpExprNode * | expr, | |
| ScopeObject * | scope | |||
| ) |
Interprets an arithmetic operation expression.
| NULL | An error occurred during interpretation. |
| [in] | expr | A pointer to the OpExprNode structure to interpret. |
| [in] | scope | A pointer to the ScopeObject structure to evaluate expr under. |
| ReturnObject* interpretAssignmentStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets an assignment statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to a StmtNode structure containing the AssignmentStmtNode structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| ReturnObject* interpretBlockNode | ( | BlockNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets the contents of a BlockNode structure.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to a BlockNode structure to interpret. |
| [in,out] | scope | A pointer to a ScopeObject structure to evaluate node under. |
| ValueObject* interpretBoolOpExprNode | ( | OpExprNode * | expr, | |
| ScopeObject * | scope | |||
| ) |
Interprets a boolean operation expression.
| NULL | An error occurred during interpretation. |
| [in] | expr | A pointer to the OpExprNode structure to interpret. |
| [in] | scope | A pointer to the ScopeObject structure to evaluate expr under. |
| ReturnObject* interpretBreakStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a break statement.
| NULL | An error occurred during interpretation. |
| node | Not used (see note). | |
| scope | Not used (see note). |
| ValueObject* interpretCastExprNode | ( | ExprNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a cast expression.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to an ExprNode structure containing the CastExprNode structure to interpret. |
| [in,out] | scope | A pointer to a ScopeObject structure to evaluate node under. |
| ReturnObject* interpretCastStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a cast statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to the StmtNode structure containing the CastStmtNode structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| ValueObject* interpretConcatOpExprNode | ( | OpExprNode * | expr, | |
| ScopeObject * | scope | |||
| ) |
Interprets a concatenation operation expression.
| NULL | An error occurred during interpretation. |
| [in] | expr | A pointer to the OpExprNode structure to interpret. |
| [in] | scope | A pointer to the ScopeObject structure to evaluate expr under. |
| ValueObject* interpretConstantExprNode | ( | ExprNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a constant expression.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to an ExprNode structure containing the ConstantNode structure to interpret. |
| scope | Not used (see note). |
| ReturnObject* interpretDeclarationStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a declaration statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to a StmtNode structure containing the DeclarationStmtNode structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| ValueObject* interpretEqualityOpExprNode | ( | OpExprNode * | expr, | |
| ScopeObject * | scope | |||
| ) |
Interprets an equality operation expression.
| NULL | An error occurred during interpretation. |
| [in] | expr | A pointer to the OpExprNode structure to interpret. |
| [in] | scope | A pointer to the ScopeObject structure to evaluate expr under. |
| ValueObject* interpretExprNode | ( | ExprNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets the contents of an ExprNode structure.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to an ExprNode structure to interpret. |
| [in] | scope | A pointer to a ScopeObject structure to evaluate node under. |
| ReturnObject* interpretExprStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets an expression statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to a StmtNode structure containing the ExprNode structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| ValueObject* interpretFuncCallExprNode | ( | ExprNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a function call expression.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to an ExprNode structure containing the FuncCallExprNode structure to interpret. |
| [in,out] | scope | A pointer to a ScopeObject structure to evaluate node under. |
| ReturnObject* interpretFuncDefStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a function definition statement.
| NULL | An error occurred during interpretation. |
| node | Not used (see note). | |
| scope | Not used (see note). |
| ValueObject* interpretIdentifierExprNode | ( | ExprNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets an identifier expression.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to an ExprNode structure containing the IdentifierNode structure to interpret. |
| scope | Not used (see note). |
| ReturnObject* interpretIfThenElseStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets an if/then/else statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to a StmtNode structure containing the IfThenElseStmtNode structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| ValueObject* interpretImpVarExprNode | ( | ExprNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets an implicit variable expression.
| [in] | node | A pointer to an ExprNode structure with type set to ET_IMPVAR. |
| scope | Not used (see note). |
| ReturnObject* interpretInputStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets an input statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to a StmtNode structure containing an InputStmtNode structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| ReturnObject* interpretLoopStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a loop statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to the StmtNode structure containing the LoopStmtNode structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| int interpretMainNode | ( | MainNode * | main | ) |
Interprets the contents of a MainNode structure.
| 0 | main was interpreted without any errors. | |
| 1 | An error occurred while interpreting main. |
| [in] | main | A pointer to the MainNode structure to interpret. |
| ValueObject* interpretNotOpExprNode | ( | OpExprNode * | expr, | |
| ScopeObject * | scope | |||
| ) |
Interprets a logical NOT operation expression.
| NULL | An error occurred during interpretation. |
| [in] | expr | A pointer to the OpExprNode structure to interpret. |
| [in] | scope | A pointer to the ScopeObject structure to evaluate expr under. |
| ValueObject* interpretOpExprNode | ( | ExprNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets an operation expression.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to an ExprNode structure to interpret. |
| [in] | scope | A pointer to a ScopeObject structure to evaluate node under. |
| ReturnObject* interpretPrintStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a print statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to a StmtNode structure containing the PrintStmtNode structure to interpret. |
| [in] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| ReturnObject* interpretReturnStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a return statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to the StmtNode structure containing the ReturnStmtNode structure to interpret. |
| [in] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| ReturnObject* interpretStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets the contents of a StmtNode structure.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to a StmtNode structure to interpret. |
| [in,out] | scope | A pointer to a ScopeObject structure to evaluate node under. |
| ReturnObject* interpretStmtNodeList | ( | StmtNodeList * | list, | |
| ScopeObject * | scope | |||
| ) |
Interprets the contents of a StmtNodeList structure.
| NULL | An error occurred during interpretation. |
| [in] | list | A pointer to the StmtNodeList structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate list under. |
| ReturnObject* interpretSwitchStmtNode | ( | StmtNode * | node, | |
| ScopeObject * | scope | |||
| ) |
Interprets a switch statement.
| NULL | An error occurred during interpretation. |
| [in] | node | A pointer to the StmtNode structure containing the SwitchStmtNode structure to interpret. |
| [in,out] | scope | A pointer to the ScopeObject structure to evaluate node under. |
| unsigned int isHexString | ( | const char * | stringdata | ) |
Checks if a string of characters follows the format for a hexadecimal number.
| 0 | The string of characters is not a hexadecimal number. | |
| 1 | The string of characters is a hexadecimal number. |
| [in] | stringdata | The array of characters to check the format of. |
| unsigned int isNumString | ( | const char * | stringdata | ) |
Checks if a string of characters follows the format for a number.
| 0 | The string of characters is not a number. | |
| 1 | The string of characters is a number. |
| [in] | stringdata | The array of characters to check the format of. |
| ValueObject* opAddFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Adds two floats.
| [in] | a | The first term to add. |
| [in] | b | The second term to add. |
| ValueObject* opAddFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Adds a float and an integer.
| [in] | a | The first term to add. |
| [in] | b | The second term to add. |
| ValueObject* opAddIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Adds an integer and a float.
| [in] | a | The first term to add. |
| [in] | b | The second term to add. |
| ValueObject* opAddIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Adds two integers.
| [in] | a | The first term to add. |
| [in] | b | The second term to add. |
| ValueObject* opDivFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Divides two floats.
| NULL | Division by zero was attempted. |
| [in] | a | The dividend. |
| [in] | b | The divisor. |
| ValueObject* opDivFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Divides a float and an integer.
| NULL | Division by zero was attempted. |
| [in] | a | The dividend. |
| [in] | b | The divisor. |
| ValueObject* opDivIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Divides an integer and a float.
| NULL | Division by zero was attempted. |
| [in] | a | The dividend. |
| [in] | b | The divisor. |
| ValueObject* opDivIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Divides two integers.
| NULL | Division by zero was attempted. |
| [in] | a | The dividend. |
| [in] | b | The divisor. |
| ValueObject* opEqBooleanBoolean | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two boolean values are equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opEqFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two floats are equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opEqFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if a float and an integer are equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opEqIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if an integer and a float are equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opEqIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two integers are equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opEqNilNil | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two nil values are equal.
| a | Not used (see note). | |
| b | Not used (see note). |
| ValueObject* opEqStringString | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two strings are equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opMaxFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Finds the maximum of two floats.
| [in] | a | The first number to compare. |
| [in] | b | The second number to compare. |
| ValueObject* opMaxFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Finds the maximum of a float and an integer.
| [in] | a | The first number to compare. |
| [in] | b | The second number to compare. |
| ValueObject* opMaxIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Finds the maximum of an integer and a float.
| [in] | a | The first number to compare. |
| [in] | b | The second number to compare. |
| ValueObject* opMaxIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Finds the maximum of two integers.
| [in] | a | The first number to compare. |
| [in] | b | The second number to compare. |
| ValueObject* opMinFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Finds the minimum of two floats.
| [in] | a | The first number to compare. |
| [in] | b | The second number to compare. |
| ValueObject* opMinFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Finds the minimum of a float and an integer.
| [in] | a | The first number to compare. |
| [in] | b | The second number to compare. |
| ValueObject* opMinIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Finds the minimum of an integer and a float.
| [in] | a | The first number to compare. |
| [in] | b | The second number to compare. |
| ValueObject* opMinIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Finds the minimum of two integers.
| [in] | a | The first number to compare. |
| [in] | b | The second number to compare. |
| ValueObject* opModFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Calculates the modulus of two floats.
| [in] | a | The dividend. |
| [in] | b | The divisor. |
| ValueObject* opModFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Calculates the modulus of a float and an integer.
| [in] | a | The dividend. |
| [in] | b | The divisor. |
| ValueObject* opModIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Calculates the modulus of an integer and a float.
| [in] | a | The dividend. |
| [in] | b | The divisor. |
| ValueObject* opModIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Calculates the modulus of two integers.
| [in] | a | The dividend. |
| [in] | b | The divisor. |
| ValueObject* opMultFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Multiplies two floats.
| [in] | a | The first factor to multiply. |
| [in] | b | The second factor to multiply. |
| ValueObject* opMultFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Multiplies a float and an integer.
| [in] | a | The first factor to multiply. |
| [in] | b | The second factor to multiply. |
| ValueObject* opMultIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Multiplies an integer and a float.
| [in] | a | The first factor to multiply. |
| [in] | b | The second factor to multiply. |
| ValueObject* opMultIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Multiplies two integers.
| [in] | a | The first factor to multiply. |
| [in] | b | The second factor to multiply. |
| ValueObject* opNeqBooleanBoolean | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two boolean values are not equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opNeqFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two floats are not equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opNeqFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if a float and an integer are not equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opNeqIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if an integer and a float are not equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opNeqIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two integers are not equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opNeqNilNil | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two nil values are not equal.
| a | Not used (see note). | |
| b | Not used (see note). |
| ValueObject* opNeqStringString | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Tests if two strings are not equal.
| [in] | a | The first value to test. |
| [in] | b | The second value to test. |
| ValueObject* opSubFloatFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Subtracts two floats.
| [in] | a | The minuend. |
| [in] | b | The subtrahend. |
| ValueObject* opSubFloatInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Subtracts a float and an integer.
| [in] | a | The minuend. |
| [in] | b | The subtrahend. |
| ValueObject* opSubIntegerFloat | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Subtracts an integer and a float.
| [in] | a | The minuend. |
| [in] | b | The subtrahend. |
| ValueObject* opSubIntegerInteger | ( | ValueObject * | a, | |
| ValueObject * | b | |||
| ) |
Subtracts two integers.
| [in] | a | The minuend. |
| [in] | b | The subtrahend. |
| ValueObject* updateScopeValue | ( | ScopeObject * | scope, | |
| IdentifierNode * | target, | |||
| ValueObject * | value | |||
| ) |
Updates a ValueObject structure named by an IdentifierNode structure in a ScopeObject structure.
| NULL | target could not be found in scope. |
| [in,out] | scope | A pointer to the ScopeObject structure to update. |
| [in] | target | A pointer to the IdentifierNode structure containing the name of the value to update. |
| [in] | value | A pointer to the ValueObject structure containing the value to copy for the update. |
1.7.1