From 419420770c4545ea4010047ef2153004d4700eed Mon Sep 17 00:00:00 2001 From: _ov4 Date: Mon, 2 Feb 2026 08:45:01 +0000 Subject: Added REAL and BOOLEAN types, DIV and MOD operators --- include/cps/AST.h | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) (limited to 'include/cps/AST.h') 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 { -- cgit v1.3.1-4-g156e