Next: src/bind, Previous: src/parse, Up: Project Layout [Contents][Index]
Namespace ‘ast’, delivered for TC-2. Implementation of the abstract syntax tree. The file ast/README gives an overview of the involved class hierarchy.
Imports Bison’s parse::location
.
Abstract base class of the compiler’s visitor hierarchy. Actually, it
defines a class template GenVisitor
, which expects an argument
which can be either misc::constify_traits
or
misc::id_traits
. This allows to define two parallel hierarchies:
ConstVisitor
and Visitor
, similar to iterator
and
const_iterator
.
The understanding of the template programming used is not required at this stage as it is quite delicate, and goes far beyond your (average) current understanding of templates.
Implementation of the GenDefaultVisitor
class template, which
walks the abstract syntax tree, doing nothing. This visitor does not
define visit methods for nodes related to object-oriented constructs
(classes, methods, etc.); thus it is an abstract class, and is solely
used as a basis for deriving other visitors. It is instantiated twice:
GenDefaultVisitor<misc::constify_traits>
and
GenDefaultVisitor<misc::id_traits>
.
Implementation of the GenNonObjectVisitor
class template, which
walks the abstract syntax tree, doing nothing, but aborting on nodes
related to object-oriented constructs (classes, methods, etc.). This
visitor is abstract and is solely used as a basis for deriving other
visitors (see TC-2 FAQ). It is instantiated twice:
GenNonObjectVisitor<misc::constify_traits>
and
GenNonObjectVisitor<misc::id_traits>
.
Implementation of the GenObjectVisitor
class template, which
walks object-related nodes of an abstract syntax tree, doing nothing.
This visitor is abstract and is solely used as a basis for deriving
other visitors. It is instantiated twice:
GenObjectVisitor<misc::constify_traits>
and
GenObjectVisitor<misc::id_traits>
.
The PrettyPrinter
class, which pretty-prints an AST back into
Tiger concrete syntax.
This class is not needed before TC-4 (see TC-4).
Auxiliary class from which typable AST node classes should derive. It has a simple interface made to manage a pointer to the type of the node:
Accessors to the type of this node.
These methods are abstract, as in ast::Ast
.
This class is not needed before TC-4 (see TC-4).
Auxiliary class from which should derive AST nodes that construct a type
(e.g., ast::ArrayTy
). Its interface is similar to that of
ast::Typable
with one big difference: ast::TypeConstructor
is responsible for de-allocating that type.
Accessors to the created type of this node.
It is convenient to be able to visit these, but it is not needed.
This class is needed only for TC-E (see TC-E).
Auxiliary class from which AST node classes that denote the declaration
of variables and formal arguments should derive. Its role is to encode
a single Boolean value: whether the variable escapes or not. The
natural interface includes escape_get
and escape_set
methods.
Next: src/bind, Previous: src/parse, Up: Project Layout [Contents][Index]