diff options
author | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-16 18:37:50 +0000 |
---|---|---|
committer | Yann Herklotz <ymherklotz@gmail.com> | 2017-03-16 18:37:50 +0000 |
commit | f7b531ebaaa784a0dcebb877ec7b831b324f3510 (patch) | |
tree | acc733a0ac5732799e6d0cc47a30da31e96e57fd /c_compiler/include | |
parent | 9ab7f5825f225cb42a6a0e8950f841a10db82f1b (diff) | |
download | Compiler-f7b531ebaaa784a0dcebb877ec7b831b324f3510.tar.gz Compiler-f7b531ebaaa784a0dcebb877ec7b831b324f3510.zip |
Check if function calls work
Diffstat (limited to 'c_compiler/include')
-rw-r--r-- | c_compiler/include/bindings.hpp | 3 | ||||
-rw-r--r-- | c_compiler/include/declaration.hpp | 2 | ||||
-rw-r--r-- | c_compiler/include/function.hpp | 8 |
3 files changed, 9 insertions, 4 deletions
diff --git a/c_compiler/include/bindings.hpp b/c_compiler/include/bindings.hpp index 367986d..81cae69 100644 --- a/c_compiler/include/bindings.hpp +++ b/c_compiler/include/bindings.hpp @@ -29,8 +29,9 @@ private: public: VariableStackBindings(); - void insertBinding(std::string id, TypePtr type, int32_t stack_position); + void insertBinding(std::string id, TypePtr type, int stack_position); void increaseStackPosition(); + void setStackPosition(int stack_counter); void resetExpressionStack(); void nextExpressionStackPosition(); diff --git a/c_compiler/include/declaration.hpp b/c_compiler/include/declaration.hpp index 391438f..f98c495 100644 --- a/c_compiler/include/declaration.hpp +++ b/c_compiler/include/declaration.hpp @@ -35,7 +35,7 @@ public: DeclarationPtr getNext() const; DeclarationPtr getNextListItem() const; std::string getId() const; - std::string getType() const; + TypePtr getType() const; }; #endif diff --git a/c_compiler/include/function.hpp b/c_compiler/include/function.hpp index f049577..9080699 100644 --- a/c_compiler/include/function.hpp +++ b/c_compiler/include/function.hpp @@ -19,15 +19,19 @@ class Function : public Node { protected: TypePtr type_; std::string id_; - DeclarationPtr parameter_list_; StatementPtr statement_; + DeclarationPtr parameter_list_; public: - Function(const std::string& id, Declaration* parameter_list, Statement* statement); + Function(const std::string& id, Statement* statement, Declaration* parameter_list = nullptr); virtual void print() const; virtual void printXml() const; virtual VariableStackBindings printAsm(VariableStackBindings bindings) const; + + void printParameterAsm(VariableStackBindings& bindings, unsigned& stack_offset, + unsigned& frame_offset) const; + void countParameters(unsigned& parameter_count) const; }; |