diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-03 16:24:07 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-03 16:24:07 +0000 |
commit | 522cc9d286c5d35ca25ebaa85374f5f9214a7f6e (patch) | |
tree | e4c944cce2fcd736834e35d8e5d06f984b57a976 /c_compiler/include/statement.hpp | |
parent | 446c2394ec8970198d645bbbb462c67b9e3f1b1e (diff) | |
download | Compiler-522cc9d286c5d35ca25ebaa85374f5f9214a7f6e.tar.gz Compiler-522cc9d286c5d35ca25ebaa85374f5f9214a7f6e.zip |
Still working on ast
Diffstat (limited to 'c_compiler/include/statement.hpp')
-rw-r--r-- | c_compiler/include/statement.hpp | 40 |
1 files changed, 10 insertions, 30 deletions
diff --git a/c_compiler/include/statement.hpp b/c_compiler/include/statement.hpp index 451d368..bf15aa5 100644 --- a/c_compiler/include/statement.hpp +++ b/c_compiler/include/statement.hpp @@ -6,61 +6,41 @@ class Statement : public BaseNode { public: - Statement() : BaseNode() {} - - Statement(const Base* _el) : BaseNode(_el) {} + Statement(const Base* _left = new EmptyNode, const Base* _right = new EmptyNode); }; class StatementList : public BaseList { public: - StatementList(const Base* _statement) : BaseList(_statement) {} + StatementList(const Base* _statement); }; class CompoundStatement : public Statement { public: - CompoundStatement() : Statement() {} - CompoundStatement(const Base* _el) : Statement(_el) {} - - CompoundStatement(const Base* _dec, const Base* _statement) { - leftNode = _dec; - rightNode = _statement; - } + CompoundStatement(const Base* _dec = new EmptyNode, const Base* _statement = new EmptyNode); - virtual void printxml() const override { - std::cout << "<Scope>" << std::endl; - leftNode->printxml(); - rightNode->printxml(); - std::cout << "</Scope>" << std::endl; - } + virtual void printxml() const override; }; class SelectionStatement : public Statement { public: - SelectionStatement() : Statement() {} - SelectionStatement(const Base* _el) : Statement(_el) {} - - SelectionStatement(const Base* _if, const Base* _else) { - leftNode = _if; - rightNode = _else; - } + SelectionStatement(const Base* _if, const Base* _else = new EmptyNode); }; class ExpressionStatement : public Statement { public: - ExpressionStatement() : Statement() {} - ExpressionStatement(const Base* expr) : Statement(expr) {} + ExpressionStatement(const Base* expr = new EmptyNode); }; class JumpStatement : public Statement { public: - JumpStatement() : Statement() {} - JumpStatement(const Base* _el) : Statement(_el) {} + JumpStatement(const Base* _el); + + virtual void printasm() const override; }; class IterationStatement : public Statement { public: - IterationStatement() : Statement() {} - IterationStatement(const Base* _el) : Statement(_el) {} + IterationStatement(const Base* _el); }; #endif |