From f1fedc36ec54578be4983d2fc6abee999dbc51c2 Mon Sep 17 00:00:00 2001 From: ov-4 Date: Thu, 29 Jan 2026 10:41:27 +0000 Subject: Added binary operations +-*/ --- include/cps/AST.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'include/cps/AST.h') diff --git a/include/cps/AST.h b/include/cps/AST.h index 5b28e8a..4d72040 100644 --- a/include/cps/AST.h +++ b/include/cps/AST.h @@ -60,4 +60,16 @@ public: ExprAST *getExpr() const { return Expr.get(); } }; +class BinaryExprAST : public ExprAST { + char Op; // '+', '-', '*', '/' + std::unique_ptr LHS, RHS; +public: + BinaryExprAST(char Op, std::unique_ptr LHS, std::unique_ptr RHS) + : Op(Op), LHS(std::move(LHS)), RHS(std::move(RHS)) {} + + char getOp() const { return Op; } + ExprAST *getLHS() const { return LHS.get(); } + ExprAST *getRHS() const { return RHS.get(); } +}; + } // namespace cps -- cgit v1.3.1-4-g156e