Class JavaParseTreeCodeGenerator
- java.lang.Object
-
- ptolemy.data.expr.AbstractParseTreeVisitor
-
- ptolemy.cg.kernel.generic.program.procedural.ProceduralParseTreeCodeGenerator
-
- ptolemy.cg.kernel.generic.program.procedural.java.JavaParseTreeCodeGenerator
-
- All Implemented Interfaces:
ParseTreeCodeGenerator
,ParseTreeVisitor
public class JavaParseTreeCodeGenerator extends ProceduralParseTreeCodeGenerator
Evaluate a parse tree given a reference to its root node and generate Java code. It implements a visitor that visits the parse tree in depth-first order, evaluating each node and storing the result as a token in the node. Two exceptions are logic nodes and the ternary if node (the ? : construct), which do not necessarily evaluate all children nodes.This class has the following limitations:
- It is a copy of ParseTreeEvaluator from data/expr and thus has lots of code for evaluating expressions, which we don't need
- It is not properly converting types: We need to add logic to convert types.
- The .tcl test has known failures involving nulls.
- It does not evaluate constants.
- Since:
- Ptolemy II 10.0
- Version:
- $Id$
- Author:
- Christopher Brooks
- See Also:
ASTPtRootNode
- Pt.AcceptedRating:
- Red
- Pt.ProposedRating:
- Red
-
-
Field Summary
-
Fields inherited from class ptolemy.cg.kernel.generic.program.procedural.ProceduralParseTreeCodeGenerator
_childCode, _depth, _evaluatedChildToken, _functionMap, _generator, _initializeCode, _preinitializeCode, _scope, _sharedCode, _trace, _typeInference, _wrapupCode
-
-
Constructor Summary
Constructors Constructor Description JavaParseTreeCodeGenerator(ProgramCodeGenerator generator)
Create a JavaParseTreeCodeGenerator that is used by the given code generator to generate code for expressions.
-
Method Summary
-
Methods inherited from class ptolemy.cg.kernel.generic.program.procedural.ProceduralParseTreeCodeGenerator
_assert, _codeGenType, _evaluateAllChildren, _evaluateArrayIndex, _evaluateChild, _powCall, _specializeArgument, _specializeReturnValue, _trace, _traceEnter, _traceLeave, escapeForTargetLanguage, evaluateParseTree, evaluateParseTree, generateFireCode, generateInitializeCode, generatePreinitializeCode, generateSharedCode, generateWrapupCode, traceParseTreeEvaluation, visitArrayConstructNode, visitBitwiseNode, visitFunctionalIfNode, visitFunctionApplicationNode, visitFunctionDefinitionNode, visitLeafNode, visitLogicalNode, visitMatrixConstructNode, visitMethodCallNode, visitPowerNode, visitProductNode, visitRecordConstructNode, visitRelationalNode, visitShiftNode, visitSumNode, visitUnaryNode
-
Methods inherited from class ptolemy.data.expr.AbstractParseTreeVisitor
_unsupportedVisitException, _visitAllChildren, _visitChild, visitAssignmentNode, visitUnionConstructNode
-
-
-
-
Constructor Detail
-
JavaParseTreeCodeGenerator
public JavaParseTreeCodeGenerator(ProgramCodeGenerator generator)
Create a JavaParseTreeCodeGenerator that is used by the given code generator to generate code for expressions.- Parameters:
generator
- The given code generator.
-
-