Next: src/frame, Previous: src/temp, Up: Project Layout [Contents][Index]
Namespace tree, delivered for TC-5. The
implementation of the intermediate representation. The file
tree/README should give enough explanations to understand how it
works.
Reading the corresponding explanations in Appel’s book is mandatory.
It is worth noting that contrary to A. Appel, just as we did for
ast, we use n-ary structures. For instance, where Appel uses a
binary seq, we have an n-ary seq which allows us to put as
many statements as we want.
To avoid gratuitous name clashes, what Appel denotes exp is
denoted sxp (Statement Expression), implemented in
translate::Sxp.
Please, pay extra attention to the fact that there are temp::Temp
used to create unique temporaries (similar to misc::symbol),
and tree::Temp which is the intermediate representation
instruction denoting a temporary (hence a tree::Temp needs a
temp::Temp). Similarly, on the one hand, there is
temp::Label which is used to create unique labels, and on the
other hand there are tree::Label which is the IR statement to
define to a label, and tree::Name used to refer to
a label (typically, a tree::Jump needs a tree::Name which
in turn needs a temp::Label).
It implements tree::Fragment, an abstract class,
tree::DataFrag to store the literal strings, and
tree::ProcFrag to store the routines.
Lists of tree::Fragment.
Implementation of tree::Visitor and tree::ConstVisitor to
implement function objects on tree::Fragments. In other words,
these visitors implement polymorphic operations on tree::Fragment.