LRDE Tiger Compiler
1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
|
Translation from ast::Ast to tree::Node. More...
Namespaces | |
namespace | tasks |
Classes | |
class | Access |
Wrapper around frame::Access. More... | |
class | Exp |
Root for all the following classes. More... | |
class | Cx |
Natural representation for conditionals. More... | |
class | Ex |
Natural representation for expressions. More... | |
class | Nx |
Natural representation for statements. More... | |
class | Ix |
Specialization of Exp for branchings. More... | |
class | Level |
Stack frames for languages with non local variables. More... | |
class | Translator |
Translate an ast::Ast into High level tree::Tree code. More... |
Typedefs | |
typedef misc::ref< Exp > | rExp |
Reference counted Exp pointer. | |
typedef misc::ref< Cx > | rCx |
Reference counted Cx pointer. | |
typedef misc::ref< Ex > | rEx |
Reference counted Ex pointer. | |
typedef misc::ref< Nx > | rNx |
Reference counted Nx pointer. | |
typedef misc::ref< Ix > | rIx |
Reference counted Ix pointer. | |
typedef std::list< const Access * > | access_list_type |
Functions | |
std::ostream & | operator<< (std::ostream &o, const Access &a) |
Report a on o for debugging. | |
std::ostream & | operator<< (std::ostream &o, const access_list_type &as) |
Report as on o for debugging. | |
std::ostream & | operator<< (std::ostream &ostr, const Exp &exp) |
Report exp on ostr. | |
std::ostream & | operator<< (std::ostream &o, const Level &l) |
Report l on o. | |
std::unique_ptr< tree::Fragments > | translate (ast::Ast &ast) |
ast::Var. | |
rExp | simple_var (const Access &access, const Level &use_level) |
rExp | field_var (rExp var_exp, int index) |
rExp | subscript_var (rExp var_exp, rExp index_exp) |
ast::Exp. | |
rExp | nil_exp () |
rExp | int_exp (int i) |
rExp | string_exp (const std::string &s, tree::Fragment *&f) |
rExp | record_exp (std::list< rExp > args) |
rExp | static_link (const Level *decl, const Level *use) |
rExp | call_exp (const temp::Label &label, std::list< rExp > args) |
Call the function LABEL. | |
rExp | call_exp (const std::string &label, rExp arg1, rExp arg2=nullptr) |
Shorthand. | |
rExp | op_exp (const ast::OpExp::Oper oper, rExp left, rExp right) |
Translation of ast::OpExp. | |
rExp | seq_exp (std::list< rExp > &exps) |
Translate an ast::SeqExp. | |
rExp | eseq_exp (std::list< rExp > &exps) |
rExp | assign_exp (rExp dst, rExp src) |
rExp | if_exp (rExp test, rExp then_clause, rExp else_clause) |
rExp | while_exp (rExp test, rExp body, const temp::Label &ldone) |
rExp | break_exp (const temp::Label &loop_end) |
rExp | array_exp (rExp array_size, rExp init_val) |
ast::Dec. | |
tree::ProcFrag * | procedure_dec (const temp::Label &label, const misc::symbol &name, rExp body, frame::Frame *frame) |
tree::ProcFrag * | function_dec (const temp::Label &label, const misc::symbol &name, rExp value, frame::Frame *frame) |
Translation from ast::Ast to tree::Node.
typedef std::list<const Access*> translate::access_list_type |
typedef misc::ref<Cx> translate::rCx |
Reference counted Cx pointer.
typedef misc::ref<Ex> translate::rEx |
Reference counted Ex pointer.
typedef misc::ref< Exp > translate::rExp |
Reference counted Exp pointer.
typedef misc::ref<Ix> translate::rIx |
Reference counted Ix pointer.
typedef misc::ref<Nx> translate::rNx |
Reference counted Nx pointer.
rExp translate::array_exp | ( | rExp | array_size, |
rExp | init_val | ||
) |
References call_exp().
rExp translate::assign_exp | ( | rExp | dst, |
rExp | src | ||
) |
Referenced by translate::Translator::operator()().
rExp translate::break_exp | ( | const temp::Label & | loop_end | ) |
Referenced by translate::Translator::operator()().
rExp translate::call_exp | ( | const temp::Label & | label, |
std::list< rExp > | args | ||
) |
Call the function LABEL.
Referenced by array_exp(), call_exp(), translate::Translator::operator()(), and record_exp().
rExp translate::call_exp | ( | const std::string & | label, |
rExp | arg1, | ||
rExp | arg2 | ||
) |
Shorthand.
References call_exp().
rExp translate::eseq_exp | ( | std::list< rExp > & | exps | ) |
Referenced by translate::Translator::operator()().
rExp translate::field_var | ( | rExp | var_exp, |
int | index | ||
) |
References tree::Binop::add, and frame::word_size.
Referenced by translate::Translator::operator()().
tree::ProcFrag * translate::function_dec | ( | const temp::Label & | label, |
const misc::symbol & | name, | ||
rExp | value, | ||
frame::Frame * | frame | ||
) |
References procedure_dec().
Referenced by translate::Translator::visit_function_dec_body().
rExp translate::if_exp | ( | rExp | test, |
rExp | then_clause, | ||
rExp | else_clause | ||
) |
rExp translate::int_exp | ( | int | i | ) |
Referenced by record_exp().
rExp translate::nil_exp | ( | ) |
Referenced by translate::Translator::operator()().
rExp translate::op_exp | ( | const ast::OpExp::Oper | oper, |
rExp | left, | ||
rExp | right | ||
) |
Translation of ast::OpExp.
std::ostream & translate::operator<< | ( | std::ostream & | o, |
const Access & | a | ||
) |
Report a on o for debugging.
References translate::Access::access_get(), translate::Access::home_get(), and translate::Level::label_get().
std::ostream & translate::operator<< | ( | std::ostream & | o, |
const access_list_type & | as | ||
) |
Report as on o for debugging.
References misc::separate().
|
inline |
Report l on o.
References translate::Level::dump().
|
inline |
Report exp on ostr.
References translate::Exp::dump().
tree::ProcFrag * translate::procedure_dec | ( | const temp::Label & | label, |
const misc::symbol & | name, | ||
rExp | body, | ||
frame::Frame * | frame | ||
) |
Referenced by function_dec(), and translate::Translator::visit_function_dec_body().
rExp translate::record_exp | ( | std::list< rExp > | args | ) |
References call_exp(), int_exp(), and frame::word_size.
Referenced by translate::Translator::operator()().
rExp translate::seq_exp | ( | std::list< rExp > & | exps | ) |
Translate an ast::SeqExp.
References tree::Seq::push_back().
Referenced by translate::Translator::operator()().
rExp translate::simple_var | ( | const Access & | access, |
const Level & | use_level | ||
) |
References translate::Access::exp().
Referenced by translate::Translator::operator()().
rExp translate::static_link | ( | const Level * | decl, |
const Level * | use | ||
) |
Compute the value of the static link for a function about to be called.
decl | the level in which the function was declared |
use | the level in which the function is called |
References assertion.
Referenced by translate::Translator::operator()().
rExp translate::string_exp | ( | const std::string & | s, |
tree::Fragment *& | f | ||
) |
rExp translate::subscript_var | ( | rExp | var_exp, |
rExp | index_exp | ||
) |
std::unique_ptr< tree::Fragments > translate::translate | ( | ast::Ast & | ast | ) |
References translate::Translator::fragments_get().
Referenced by translate::tasks::hir_compute().
rExp translate::while_exp | ( | rExp | test, |
rExp | body, | ||
const temp::Label & | ldone | ||
) |