write basic functions for LLVM IR
This commit is contained in:
@ -11,6 +11,7 @@ class Statement_ASTNode : public ASTNodeBase {
|
||||
class EmptyStatement_ASTNode : public Statement_ASTNode {
|
||||
friend Visitor;
|
||||
friend class ASTSemanticCheckVisitor;
|
||||
friend class IRBuilder;
|
||||
|
||||
public:
|
||||
EmptyStatement_ASTNode() = default;
|
||||
@ -19,6 +20,7 @@ class EmptyStatement_ASTNode : public Statement_ASTNode {
|
||||
class DefinitionStatement_ASTNode : public Statement_ASTNode {
|
||||
friend Visitor;
|
||||
friend class ASTSemanticCheckVisitor;
|
||||
friend class IRBuilder;
|
||||
ExprTypeInfo var_type;
|
||||
std::vector<std::pair<IdentifierType, std::shared_ptr<Expr_ASTNode>>> vars;
|
||||
|
||||
@ -29,6 +31,7 @@ class DefinitionStatement_ASTNode : public Statement_ASTNode {
|
||||
class ExprStatement_ASTNode : public Statement_ASTNode {
|
||||
friend Visitor;
|
||||
friend class ASTSemanticCheckVisitor;
|
||||
friend class IRBuilder;
|
||||
std::shared_ptr<Expr_ASTNode> expr;
|
||||
|
||||
public:
|
||||
@ -38,6 +41,7 @@ class ExprStatement_ASTNode : public Statement_ASTNode {
|
||||
class IfStatement_ASTNode : public Statement_ASTNode {
|
||||
friend Visitor;
|
||||
friend class ASTSemanticCheckVisitor;
|
||||
friend class IRBuilder;
|
||||
bool has_else_clause;
|
||||
std::shared_ptr<Expr_ASTNode> condition;
|
||||
std::shared_ptr<Statement_ASTNode> if_clause;
|
||||
@ -50,6 +54,7 @@ class IfStatement_ASTNode : public Statement_ASTNode {
|
||||
class WhileStatement_ASTNode : public Statement_ASTNode {
|
||||
friend Visitor;
|
||||
friend class ASTSemanticCheckVisitor;
|
||||
friend class IRBuilder;
|
||||
std::shared_ptr<Expr_ASTNode> condition;
|
||||
std::shared_ptr<Statement_ASTNode> loop_body;
|
||||
|
||||
@ -60,6 +65,7 @@ class WhileStatement_ASTNode : public Statement_ASTNode {
|
||||
class ForStatement_ASTNode : public Statement_ASTNode {
|
||||
friend Visitor;
|
||||
friend class ASTSemanticCheckVisitor;
|
||||
friend class IRBuilder;
|
||||
std::shared_ptr<Statement_ASTNode> initial;
|
||||
std::shared_ptr<Expr_ASTNode> condition;
|
||||
std::shared_ptr<Statement_ASTNode> update;
|
||||
@ -72,6 +78,7 @@ class ForStatement_ASTNode : public Statement_ASTNode {
|
||||
class JmpStatement_ASTNode : public Statement_ASTNode {
|
||||
friend Visitor;
|
||||
friend class ASTSemanticCheckVisitor;
|
||||
friend class IRBuilder;
|
||||
uint8_t jmp_type; // 0: return, 1: break, 2: continue
|
||||
std::shared_ptr<Expr_ASTNode> return_value;
|
||||
|
||||
@ -82,6 +89,7 @@ class JmpStatement_ASTNode : public Statement_ASTNode {
|
||||
class SuiteStatement_ASTNode : public Statement_ASTNode {
|
||||
friend Visitor;
|
||||
friend class ASTSemanticCheckVisitor;
|
||||
friend class IRBuilder;
|
||||
std::vector<std::shared_ptr<Statement_ASTNode>> statements;
|
||||
|
||||
public:
|
||||
|
Reference in New Issue
Block a user