Namespace translate. Translation to intermediate code translation. It includes:
The interface.
The compiled module.
It implements
translate::Fragment
, an abstract class,translate::DataFrag
to store the literal strings, andtranslate::ProcFrag
to store the routines.
Static link aware versions of
level::Access
.
translate::Level
are wrappersframe::Frame
that support the static links, so that we can find an access to the variables of the “parent function”.
Implementation of
translate::Ex
(expressions),Nx
(instructions),Cx
(conditions), andIx
(if
) shells. They wraptree::Node
to delay their translation until the actual use is known.
All the information that the environment must keep about variables and functions.
The levels environment, containing LevelVarEntry's and LevelFunEntry's. We don't need to store information related to types here.
functions used by the
translate::TranslateVisitor
to translate the AST into HIR. For instance, it contains Exp *simpleVar (const Access &access, const Level &level), Exp *callExp (const temp::Label &label, std::list<Exp *> args) etc. which are routines that produce some Tree::Exp. They handle all theunCx
etc. magic.
Implements the class TranslateVisitor which performs the IR generation thanks to translation.hh. It must not be polluted with translation details: it is only coordinating the AST traversal with the invocation of translation routines. For instance, here is the translation of a ast::SimpleVar:
virtual void visit (const SimpleVar& e) { const Access &access = env_.var_access_get (e.name_get ()); exp_ = simpleVar (access, *level_); }