ready to build AST
This commit is contained in:
42
include/ast/statement_astnode.h
Normal file
42
include/ast/statement_astnode.h
Normal file
@ -0,0 +1,42 @@
|
||||
#ifndef STATEMENT_ASTNODE_H
|
||||
#define STATEMENT_ASTNODE_H
|
||||
#include <vector>
|
||||
#include "astnode.h"
|
||||
#include "expr_astnode.h"
|
||||
class Statement_ASTNode : public ASTNodeBase {
|
||||
public:
|
||||
virtual ~Statement_ASTNode() = default;
|
||||
};
|
||||
|
||||
class EmptyStatement_ASTNode : public Statement_ASTNode {};
|
||||
class DefinitionStatement_ASTNode : public Statement_ASTNode {
|
||||
ExprTypeInfo type;
|
||||
std::vector<std::pair<IdentifierType, std::shared_ptr<Expr_ASTNode>>> vars;
|
||||
};
|
||||
class ExprStatement_ASTNode : public Statement_ASTNode {
|
||||
std::shared_ptr<Expr_ASTNode> expr;
|
||||
};
|
||||
class IfStatement_ASTNode : public Statement_ASTNode {
|
||||
bool has_else_clause;
|
||||
std::shared_ptr<Expr_ASTNode> condition;
|
||||
std::shared_ptr<Statement_ASTNode> if_clause;
|
||||
std::shared_ptr<Statement_ASTNode> else_clause;
|
||||
};
|
||||
class WhileStatement_ASTNode : public Statement_ASTNode {
|
||||
std::shared_ptr<Expr_ASTNode> condition;
|
||||
std::shared_ptr<Statement_ASTNode> loop_body;
|
||||
};
|
||||
class ForStatement_ASTNode : public Statement_ASTNode {
|
||||
std::shared_ptr<Statement_ASTNode> initial;
|
||||
std::shared_ptr<Expr_ASTNode> condition;
|
||||
std::shared_ptr<Statement_ASTNode> update;
|
||||
std::shared_ptr<Statement_ASTNode> loop_body;
|
||||
};
|
||||
class JmpStatement_ASTNode : public Statement_ASTNode {
|
||||
std::shared_ptr<Expr_ASTNode> return_value;
|
||||
};
|
||||
class SuiteStatement_ASTNode : public Statement_ASTNode {
|
||||
std::vector<std::shared_ptr<Statement_ASTNode>> statements;
|
||||
};
|
||||
|
||||
#endif // STATEMENT_ASTNODE_H
|
Reference in New Issue
Block a user