diff options
| author | _ov4 <hausemasterstream@gmail.com> | 2026-02-02 08:45:01 +0000 |
|---|---|---|
| committer | _ov4 <hausemasterstream@gmail.com> | 2026-02-02 08:45:01 +0000 |
| commit | 419420770c4545ea4010047ef2153004d4700eed (patch) | |
| tree | bd19eed681dbb68ecb501b6cfc220c42a9803ef3 /include/cps/AST.h | |
| parent | ecc0fc463ba54dd0cbe33bc14415f432eaa959de (diff) | |
Added REAL and BOOLEAN types, DIV and MOD operators
Diffstat (limited to 'include/cps/AST.h')
| -rw-r--r-- | include/cps/AST.h | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/include/cps/AST.h b/include/cps/AST.h index 7c50ee9..588f5eb 100644 --- a/include/cps/AST.h +++ b/include/cps/AST.h @@ -11,13 +11,27 @@ public: virtual ~ExprAST() = default; }; -class NumberExprAST : public ExprAST { +class IntegerExprAST : public ExprAST { int64_t Val; public: - NumberExprAST(int64_t Val) : Val(Val) {} + IntegerExprAST(int64_t Val) : Val(Val) {} int64_t getVal() const { return Val; } }; +class RealExprAST : public ExprAST { + double Val; +public: + RealExprAST(double Val) : Val(Val) {} + double getVal() const { return Val; } +}; + +class BooleanExprAST : public ExprAST { + bool Val; +public: + BooleanExprAST(bool Val) : Val(Val) {} + bool getVal() const { return Val; } +}; + class VariableExprAST : public ExprAST { std::string Name; public: @@ -57,9 +71,12 @@ public: class DeclareStmtAST : public StmtAST { std::string Name; + std::string Type; public: - DeclareStmtAST(const std::string &Name) : Name(Name) {} + DeclareStmtAST(const std::string &Name, const std::string &Type = "INTEGER") + : Name(Name), Type(Type) {} const std::string &getName() const { return Name; } + const std::string &getType() const { return Type; } }; class ArrayDeclareStmtAST : public StmtAST { |
