LRDE Tiger Compiler  1.34a $Id: 7fef12e1f5fa43449d667a0eec1d837c40fc1202 $
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
translate Namespace Reference

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< ExprExp
 Reference counted Exp pointer.
typedef misc::ref< CxrCx
 Reference counted Cx pointer.
typedef misc::ref< ExrEx
 Reference counted Ex pointer.
typedef misc::ref< NxrNx
 Reference counted Nx pointer.
typedef misc::ref< IxrIx
 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::Fragmentstranslate (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::ProcFragprocedure_dec (const temp::Label &label, const misc::symbol &name, rExp body, frame::Frame *frame)
tree::ProcFragfunction_dec (const temp::Label &label, const misc::symbol &name, rExp value, frame::Frame *frame)

Detailed Description

Translation from ast::Ast to tree::Node.

Typedef Documentation

typedef std::list<const Access*> translate::access_list_type

Reference counted Cx pointer.

Reference counted Ex pointer.

Reference counted Exp pointer.

Reference counted Ix pointer.

Reference counted Nx pointer.

Function Documentation

rExp translate::array_exp ( rExp  array_size,
rExp  init_val 
)

References call_exp().

rExp translate::assign_exp ( rExp  dst,
rExp  src 
)
rExp translate::break_exp ( const temp::Label loop_end)
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)
rExp translate::field_var ( rExp  var_exp,
int  index 
)
tree::ProcFrag * translate::function_dec ( const temp::Label label,
const misc::symbol name,
rExp  value,
frame::Frame frame 
)
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 ( )
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 
)
std::ostream & translate::operator<< ( std::ostream &  o,
const access_list_type &  as 
)

Report as on o for debugging.

References misc::separate().

std::ostream & translate::operator<< ( std::ostream &  o,
const Level &  l 
)
inline

Report l on o.

References translate::Level::dump().

std::ostream & translate::operator<< ( std::ostream &  ostr,
const Exp &  exp 
)
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 
)
rExp translate::record_exp ( std::list< rExp >  args)
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 
)
rExp translate::static_link ( const Level *  decl,
const Level *  use 
)

Compute the value of the static link for a function about to be called.

Parameters
declthe level in which the function was declared
usethe 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)
rExp translate::while_exp ( rExp  test,
rExp  body,
const temp::Label ldone 
)