diff options
| author | Nagi5Yeq <wu@x-nagi.com> | 2020-05-28 01:26:57 +0800 |
|---|---|---|
| committer | Nagi5Yeq <wu@x-nagi.com> | 2020-05-28 01:26:57 +0800 |
| commit | 5fc580a0fe1ef35f0706394ec9ebb2a088deb5e9 (patch) | |
| tree | 8ebc5bf451f73fee141372c18aaf7041fca09254 /node/StatementNode.hh | |
| parent | c84e212d0de5ff9f14ab14ac5143e56d2839ac82 (diff) | |
add if, while, repeat
fix function call
modify syntax
Diffstat (limited to 'node/StatementNode.hh')
| -rw-r--r-- | node/StatementNode.hh | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/node/StatementNode.hh b/node/StatementNode.hh index 68c808f..1bd0cb6 100644 --- a/node/StatementNode.hh +++ b/node/StatementNode.hh @@ -25,6 +25,41 @@ class AssignStatementNode : public BaseNode { std::shared_ptr<ExprNode> lhs_; std::shared_ptr<ExprNode> rhs_; }; + +class IfStatementNode : public BaseNode { + public: + IfStatementNode(Context* context, std::shared_ptr<ExprNode> expr, + std::shared_ptr<BaseNode> ThenPart, + std::shared_ptr<BaseNode> ElsePart); + virtual Value CodeGen() override; + + protected: + std::shared_ptr<ExprNode> expr_; + std::shared_ptr<BaseNode> ThenPart_; + std::shared_ptr<BaseNode> ElsePart_; +}; + +class WhileStatementNode : public BaseNode { + public: + WhileStatementNode(Context* context, std::shared_ptr<ExprNode> expr, + std::shared_ptr<BaseNode> WhileBody); + virtual Value CodeGen() override; + + protected: + std::shared_ptr<ExprNode> expr_; + std::shared_ptr<BaseNode> WhileBody_; +}; + +class RepeatStatementNode : public BaseNode { + public: + RepeatStatementNode(Context* context, std::shared_ptr<ExprNode> expr, + std::shared_ptr<BaseNode> RepeatBody); + virtual Value CodeGen() override; + + protected: + std::shared_ptr<ExprNode> expr_; + std::shared_ptr<BaseNode> RepeatBody_; +}; } // namespace pcc #endif |
