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

Desugaring an ast::Ast. More...

Namespaces

namespace  tasks
 Tasks of the desugar module.

Classes

class  BoundCheckingVisitor
 Add dynamic array bound checks while duplicating an AST. More...
class  DesugarVisitor
 Desugar some syntactic structures while duplicating an Ast. More...

Functions

template<typename A >
void bind_and_types_check (A &tree)
template void bind_and_types_check< ast::DecsList > (ast::DecsList &)
template<typename A >
A * raw_desugar (const A &tree, bool desugar_for_p, bool desugar_string_cmp_p)
 Remove the syntactic sugar from an AST without recomputing its bindings nor its types.
template<typename A >
A * desugar (const A &tree, bool desugar_for_p, bool desugar_string_cmp_p)
 Remove the syntactic sugar from an AST.
template ast::DecsListraw_desugar (const ast::DecsList &, bool, bool)
 Explicit instantiations.
template ast::DecsListdesugar (const ast::DecsList &, bool, bool)
template<typename A >
A * raw_bound_checks_add (const A &tree)
 Remove the syntactic sugar from an AST without recomputing its bindings nor its types.
template<typename A >
A * bound_checks_add (const A &tree)
 Add runtime checks of array bounds.
template ast::DecsListraw_bound_checks_add (const ast::DecsList &t)
 Explicit instantiations.
template ast::DecsListbound_checks_add (const ast::DecsList &t)

Detailed Description

Desugaring an ast::Ast.

Function Documentation

template<typename A >
void desugar::bind_and_types_check ( A &  tree)

Recompute the bindings and the types of the AST tree.

Raise an Internal Compiler Error on failure.

References overload::bind(), and object::types_check().

Referenced by bound_checks_add(), desugar(), object::desugar(), inlining::inline_expand(), and inlining::prune().

template<typename A >
A * desugar::bound_checks_add ( const A &  tree)

Add runtime checks of array bounds.

Parameters
treeabstract syntax tree's root, whose bindings and types have been computed, and whose identifiers are all unique.
Returns
the AST with bound checks, with bindings and type-checked.

References assertion, bind_and_types_check(), and raw_bound_checks_add().

Referenced by desugar::tasks::bound_checks_add().

template ast::DecsList* desugar::bound_checks_add ( const ast::DecsList t)
template<typename A >
A * desugar::desugar ( const A &  tree,
bool  desugar_for_p,
bool  desugar_string_cmp_p 
)

Remove the syntactic sugar from an AST.

Parameters
treeabstract syntax tree's root, whose bindings and types have been computed, and whose identifiers are all unique.
desugar_for_pdesugar `for' loops.
desugar_string_cmp_pdesugar string comparisons.
Returns
the desugared, bound and type-checked AST.

References assertion, bind_and_types_check(), and raw_desugar().

Referenced by raw_desugar().

template ast::DecsList* desugar::desugar ( const ast::DecsList ,
bool  ,
bool   
)
template<typename A >
A * desugar::raw_bound_checks_add ( const A &  tree)

Remove the syntactic sugar from an AST without recomputing its bindings nor its types.

This function acts like desugar::bound_checks_add, but stops just after the tranformation step (in fact, desugar::bound_checks_add is built upon this function). It is meant to be used as a test of BoundCheckingVisitor (i.e., even if the tree with bound checks is badly bound or typed, it can still be pretty-printed).

Parameters
treeAST on which bound checks are to be added
Returns
the AST with bound checks.

References astclone::Cloner::result_get().

Referenced by bound_checks_add(), and desugar::tasks::raw_bound_checks_add().

template ast::DecsList* desugar::raw_bound_checks_add ( const ast::DecsList t)

Explicit instantiations.

template<typename A >
A * desugar::raw_desugar ( const A &  tree,
bool  desugar_for_p,
bool  desugar_string_cmp_p 
)

Remove the syntactic sugar from an AST without recomputing its bindings nor its types.

This function acts like desugar::desugar, but stops just after the desugaring step (in fact, desugar::desugar is built upon this function). It is meant to be used as a test of DesugarVisitor (i.e., even if the desugared tree is badly bound or typed, it can still be pretty-printed).

Parameters
treeAST to desugar.
desugar_for_pdesugar `for' loops.
desugar_string_cmp_pdesugar string comparisons.
Returns
the desugared AST.

References desugar(), and astclone::Cloner::result_get().

Referenced by desugar().

template ast::DecsList* desugar::raw_desugar ( const ast::DecsList ,
bool  ,
bool   
)

Explicit instantiations.