diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-10 12:48:53 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-10 12:48:53 +0000 |
commit | 28251a0c6f4e31c63c12746ffa77e05c669ef80d (patch) | |
tree | e1a9dfad8db410a0ae0db0e56f1bfc9accac6262 /c_compiler/src/statement.cpp | |
parent | 3e145bf08b1ffcccb4df8f2fc34f5bb95b5b250c (diff) | |
download | Compiler-28251a0c6f4e31c63c12746ffa77e05c669ef80d.tar.gz Compiler-28251a0c6f4e31c63c12746ffa77e05c669ef80d.zip |
Changing printasm
Diffstat (limited to 'c_compiler/src/statement.cpp')
-rw-r--r-- | c_compiler/src/statement.cpp | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/c_compiler/src/statement.cpp b/c_compiler/src/statement.cpp index 99b2879..7b98631 100644 --- a/c_compiler/src/statement.cpp +++ b/c_compiler/src/statement.cpp @@ -1,4 +1,8 @@ -#include "ast.hpp" +#include "statement.hpp" +#include "declaration.hpp" +#include "expression.hpp" + +#include <iostream> // General base Statement definition @@ -48,15 +52,15 @@ void CompoundStatement::printxml() const std::cout << "</Scope>" << std::endl; } -void CompoundStatement::printasm() const +VariableStackBindings CompoundStatement::printasm(VariableStackBindings bindings, int32_t& var_count) const { if(next_statement != nullptr) - next_statement->printasm(); + next_statement->printasm(bindings, var_count); // TODO printasm for the declaration if(m_statement != nullptr) - m_statement->printasm(); + m_statement->printasm(bindings, var_count); } void CompoundStatement::count_variables(int32_t& var_count) const @@ -106,7 +110,7 @@ void SelectionStatement::printxml() const m_else->printxml(); } -void SelectionStatement::printasm() const +VariableStackBindings SelectionStatement::printasm(VariableStackBindings bindings, int32_t& var_count) const {} void SelectionStatement::count_variables(int32_t& var_count) const @@ -134,7 +138,7 @@ void ExpressionStatement::print() const void ExpressionStatement::printxml() const {} -void ExpressionStatement::printasm() const +VariableStackBindings ExpressionStatement::printasm(VariableStackBindings bindings, int32_t& var_count) const {} void ExpressionStatement::count_variables(int32_t& var_count) const @@ -159,9 +163,9 @@ void JumpStatement::printxml() const next_statement->printxml(); } -void JumpStatement::printasm() const +VariableStackBindings JumpStatement::printasm(VariableStackBindings bindings, int32_t& var_count) const { - m_expr->printasm(); + m_expr->printasm(bindings, var_count); } void JumpStatement::count_variables(int32_t& var_count) const @@ -188,7 +192,7 @@ void IterationStatement::printxml() const m_statement->printxml(); } -void IterationStatement::printasm() const +VariableStackBindings IterationStatement::printasm(VariableStackBindings bindings, int32_t& var_count) const {} void IterationStatement::count_variables(int32_t& var_count) const |