|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectptolemy.data.expr.AbstractParseTreeVisitor
ptolemy.data.expr.CParseTreeCodeGenerator
public class CParseTreeCodeGenerator
This class visits parse trees and generates soot instructions that evaluate the parse tree.
ASTPtRootNode
Red (cxh) |
Red (neuendor) |
Field Summary | |
---|---|
protected int |
_nodeNumber
The node number, used to create unique node names. |
protected java.util.HashMap |
_nodeToLocalName
A map from node to local node name. |
Constructor Summary | |
---|---|
CParseTreeCodeGenerator()
|
Method Summary | |
---|---|
protected void |
_assert(boolean flag,
ASTPtRootNode node,
java.lang.String message)
Assert that the given boolean value, which describes the given parse tree node is true. |
protected void |
_generateAllChildren(ASTPtRootNode node)
Loop through all of the children of this node, visiting each one of them, which will cause their token value to be determined. |
protected void |
_generateChild(ASTPtRootNode node,
int i)
Visit the child with the given index of the given node. |
protected java.lang.String |
_getLocalNameForName(java.lang.String name)
Get the local name for this this name. |
protected boolean |
_isValidName(java.lang.String name)
Return true if the name is a valid name. |
void |
generateCode(ASTPtRootNode node)
Generate code for a node. |
void |
visitArrayConstructNode(ASTPtArrayConstructNode node)
|
void |
visitBitwiseNode(ASTPtBitwiseNode node)
|
void |
visitFunctionalIfNode(ASTPtFunctionalIfNode node)
|
void |
visitFunctionApplicationNode(ASTPtFunctionApplicationNode node)
|
void |
visitFunctionDefinitionNode(ASTPtFunctionDefinitionNode node)
|
void |
visitLeafNode(ASTPtLeafNode node)
|
void |
visitLogicalNode(ASTPtLogicalNode node)
|
void |
visitMatrixConstructNode(ASTPtMatrixConstructNode node)
|
void |
visitMethodCallNode(ASTPtMethodCallNode node)
|
void |
visitPowerNode(ASTPtPowerNode node)
|
void |
visitProductNode(ASTPtProductNode node)
|
void |
visitRecordConstructNode(ASTPtRecordConstructNode node)
|
void |
visitRelationalNode(ASTPtRelationalNode node)
|
void |
visitShiftNode(ASTPtShiftNode node)
|
void |
visitSumNode(ASTPtSumNode node)
|
void |
visitUnaryNode(ASTPtUnaryNode node)
|
Methods inherited from class ptolemy.data.expr.AbstractParseTreeVisitor |
---|
_unsupportedVisitException, _visitAllChildren, _visitChild, visitAssignmentNode, visitUnionConstructNode |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.util.HashMap _nodeToLocalName
protected int _nodeNumber
Constructor Detail |
---|
public CParseTreeCodeGenerator()
Method Detail |
---|
public void generateCode(ASTPtRootNode node) throws IllegalActionException
node
- The node for which code is generated.
IllegalActionException
- If type inference fails.public void visitArrayConstructNode(ASTPtArrayConstructNode node) throws IllegalActionException
visitArrayConstructNode
in interface ParseTreeVisitor
visitArrayConstructNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitBitwiseNode(ASTPtBitwiseNode node) throws IllegalActionException
visitBitwiseNode
in interface ParseTreeVisitor
visitBitwiseNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitFunctionApplicationNode(ASTPtFunctionApplicationNode node) throws IllegalActionException
visitFunctionApplicationNode
in interface ParseTreeVisitor
visitFunctionApplicationNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitFunctionalIfNode(ASTPtFunctionalIfNode node) throws IllegalActionException
visitFunctionalIfNode
in interface ParseTreeVisitor
visitFunctionalIfNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitFunctionDefinitionNode(ASTPtFunctionDefinitionNode node) throws IllegalActionException
visitFunctionDefinitionNode
in interface ParseTreeVisitor
visitFunctionDefinitionNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitLeafNode(ASTPtLeafNode node) throws IllegalActionException
visitLeafNode
in interface ParseTreeVisitor
visitLeafNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitLogicalNode(ASTPtLogicalNode node) throws IllegalActionException
visitLogicalNode
in interface ParseTreeVisitor
visitLogicalNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitMatrixConstructNode(ASTPtMatrixConstructNode node) throws IllegalActionException
visitMatrixConstructNode
in interface ParseTreeVisitor
visitMatrixConstructNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitMethodCallNode(ASTPtMethodCallNode node) throws IllegalActionException
visitMethodCallNode
in interface ParseTreeVisitor
visitMethodCallNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitPowerNode(ASTPtPowerNode node) throws IllegalActionException
visitPowerNode
in interface ParseTreeVisitor
visitPowerNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitProductNode(ASTPtProductNode node) throws IllegalActionException
visitProductNode
in interface ParseTreeVisitor
visitProductNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitRecordConstructNode(ASTPtRecordConstructNode node) throws IllegalActionException
visitRecordConstructNode
in interface ParseTreeVisitor
visitRecordConstructNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitRelationalNode(ASTPtRelationalNode node) throws IllegalActionException
visitRelationalNode
in interface ParseTreeVisitor
visitRelationalNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitShiftNode(ASTPtShiftNode node) throws IllegalActionException
visitShiftNode
in interface ParseTreeVisitor
visitShiftNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitSumNode(ASTPtSumNode node) throws IllegalActionException
visitSumNode
in interface ParseTreeVisitor
visitSumNode
in class AbstractParseTreeVisitor
IllegalActionException
public void visitUnaryNode(ASTPtUnaryNode node) throws IllegalActionException
visitUnaryNode
in interface ParseTreeVisitor
visitUnaryNode
in class AbstractParseTreeVisitor
IllegalActionException
protected void _assert(boolean flag, ASTPtRootNode node, java.lang.String message)
flag
- The value to be checked. If false, then an
InternalErrorException is thrown.node
- The node.message
- The error message to be included in the exception
if the flag parameter is false.protected void _generateAllChildren(ASTPtRootNode node) throws IllegalActionException
node
- The node.
IllegalActionException
protected void _generateChild(ASTPtRootNode node, int i) throws IllegalActionException
node
- The node.i
- The index of the child to be visited.
IllegalActionException
- If thrown while visiting a child
node.protected java.lang.String _getLocalNameForName(java.lang.String name) throws IllegalActionException
name
- The name to be looked up.
IllegalActionException
- Always thrown in this base class.protected boolean _isValidName(java.lang.String name) throws IllegalActionException
name
- The name to be looked up.
IllegalActionException
- Not thrown in this base class.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |