Package scale.clef

Provides for the Clef Abstract Syntax Tree (AST) form used to represent the source language program as closely as possible.

See:
          Description

Interface Summary
DeclPredicate This is the predicate class for the visit pattern of Clef Declarations.
ExprPredicate Predicate class for visit pattern of Clef Expressions.
Predicate The predicate for the visit pattern on Clef AST nodes.
StmtPredicate The class for the visit pattern of Clef Statements.
TypePredicate Predicate class for visit pattern of Clef Types.
 

Class Summary
Clef2C A class to generate C code from a Clef AST.
DescendPredicate This is an abstract class that implements a recursive descent visit of a Clef AST class tree.
Display A class which generates information to generate a graph of a Clef tree.
ErrorPredicate This class provides a default implementation of the Predicate visit pattern that generates an error.
LiteralMap This class maps from a value to a Clef Literal.
Node The base class for the Clef representation.
PureFunctionAnnotation This annotation is used to mark routines as being "pure functions".
 

Package scale.clef Description

Provides for the Clef Abstract Syntax Tree (AST) form used to represent the source language program as closely as possible. The CallGraph class is the container for the AST. The Node class is the base class for all nodes of the tree. The nodes are composed of expressions, declarations, statements, and types.

The Clef AST is supposed to be language DEPENDENT. That means that you may have to define some additional Clef classes if you want to add support for another language such as Ada. Some of the Clef classes are left over from an aborted effort to compile Modula III and C++. Don't depend on any Clef classes, that not used for C or Fortran, to be correct.

If you add classes to Clef, you will need to add code for them to the scale.clef.Clef2C Clef2C} class as well as other classes in the scale.clef package.

Each class, descended from the Node class, implements a visit(Predicate p) method which calls the visitXXX() method of its arguments class where XXX is the its class name. For example, the AdditionOp class implements

  public void visit(Predicate p)
  {
    p.visitAdditionOp(this);
  }
In this way the "visit pattern" is implemented and provides a way to visit every node of the AST. Several base classes are implemented for the creation of visit algorithms.
DescendPredicate
which calls the visit method of each class's super class.
ErrorPredicate
which generates an error.
Predicate
which is the base class of all visit classes.