1 #ifndef VISITORS_SIMPLIFY_HH
2 # define VISITORS_SIMPLIFY_HH
6 # include <ozulis/ast/ast.hh>
7 # include <ozulis/visitors/visitor.hh>
14 * @brief transforms an AST to 3 address instructions.
16 class Simplify
: public Visitor
<Simplify
>
22 static void initBase();
24 void simplifyLValue(ast::Exp
*& exp
);
25 void simplify(ast::Exp
*& node
);
26 void makeTmpResult(ast::Exp
& node
);
28 std::string
currentId() const;
31 /// @brief the new list of 3 address instructions
32 std::vector
<ast::Node
*> simplifications
;
33 /// @brief the child which replace the previously visited node
34 ast::Exp
* replacement
;
35 /// @brief the next id for register count
37 /// @brief the current scope, to retype check some generated expressions
43 #endif /* !VISITORS_SIMPLIFY_HH */