Class CParseTreeCodeGenerator

  • All Implemented Interfaces:
    ParseTreeCodeGenerator, ParseTreeVisitor

    public class CParseTreeCodeGenerator
    extends ProceduralParseTreeCodeGenerator
    This class evaluates a parse tree given a reference to its root node. 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:
    Man-Kit Leung
    See Also:
    ASTPtRootNode
    Pt.AcceptedRating:
    Red
    Pt.ProposedRating:
    Red