aboutsummaryrefslogtreecommitdiff
path: root/include/cps/AST.h
diff options
context:
space:
mode:
authorov-4 <hausemasterstream@gmail.com>2026-01-29 14:24:05 +0000
committerov-4 <hausemasterstream@gmail.com>2026-01-29 14:24:05 +0000
commit943ed04b775949e8bc4948bcb8d762a32ab14f76 (patch)
tree5c8d09bcd702558e1fba25e176712a1697a6c7e7 /include/cps/AST.h
parent4573880fcc32bd76a72a4ae713190cd997194583 (diff)
Added array
Diffstat (limited to 'include/cps/AST.h')
-rw-r--r--include/cps/AST.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/include/cps/AST.h b/include/cps/AST.h
index 1473c45..aaf81cb 100644
--- a/include/cps/AST.h
+++ b/include/cps/AST.h
@@ -24,6 +24,16 @@ public:
const std::string &getName() const { return Name; }
};
+class ArrayAccessExprAST : public ExprAST {
+ std::string Name;
+ std::vector<std::unique_ptr<ExprAST>> Indices;
+public:
+ ArrayAccessExprAST(const std::string &Name, std::vector<std::unique_ptr<ExprAST>> Indices)
+ : Name(Name), Indices(std::move(Indices)) {}
+ const std::string &getName() const { return Name; }
+ const std::vector<std::unique_ptr<ExprAST>> &getIndices() const { return Indices; }
+};
+
class BinaryExprAST : public ExprAST {
int Op;
std::unique_ptr<ExprAST> LHS, RHS;
@@ -47,6 +57,21 @@ public:
const std::string &getName() const { return Name; }
};
+class ArrayDeclareStmtAST : public StmtAST {
+ std::string Name;
+ std::vector<std::pair<std::unique_ptr<ExprAST>, std::unique_ptr<ExprAST>>> Bounds;
+ std::string Type;
+public:
+ ArrayDeclareStmtAST(const std::string &Name,
+ std::vector<std::pair<std::unique_ptr<ExprAST>, std::unique_ptr<ExprAST>>> Bounds,
+ const std::string &Type)
+ : Name(Name), Bounds(std::move(Bounds)), Type(Type) {}
+
+ const std::string &getName() const { return Name; }
+ const std::vector<std::pair<std::unique_ptr<ExprAST>, std::unique_ptr<ExprAST>>> &getBounds() const { return Bounds; }
+ const std::string &getType() const { return Type; }
+};
+
class AssignStmtAST : public StmtAST {
std::string Name;
std::unique_ptr<ExprAST> Expr;
@@ -57,6 +82,18 @@ public:
ExprAST *getExpr() const { return Expr.get(); }
};
+class ArrayAssignStmtAST : public StmtAST {
+ std::string Name;
+ std::vector<std::unique_ptr<ExprAST>> Indices;
+ std::unique_ptr<ExprAST> Expr;
+public:
+ ArrayAssignStmtAST(const std::string &Name, std::vector<std::unique_ptr<ExprAST>> Indices, std::unique_ptr<ExprAST> Expr)
+ : Name(Name), Indices(std::move(Indices)), Expr(std::move(Expr)) {}
+ const std::string &getName() const { return Name; }
+ const std::vector<std::unique_ptr<ExprAST>> &getIndices() const { return Indices; }
+ ExprAST *getExpr() const { return Expr.get(); }
+};
+
class InputStmtAST : public StmtAST {
std::string Name;
public: