Tree-building almost works
[cparser.git] / src / BinExpr.cpp
blob66af441c443c43aa18cb01e97ad69fb6750a0cce
1 #include "BinExpr.hpp"
3 BinExpr::BinExpr(Expr* a1, Expr* a2): m_a1(a1), m_a2(a2) {}
5 AddExpr::AddExpr(Expr* n1, Expr* n2) : BinExpr(n1, n2) {}
7 Number AddExpr::eval() const
9 return left()->eval();// + right()->eval();
12 SubExpr::SubExpr(Expr* n1, Expr* n2) : BinExpr(n1, n2) {}
14 Number SubExpr::eval() const
16 return left()->eval() - right()->eval();
19 MulExpr::MulExpr(Expr* n1, Expr* n2) : BinExpr(n1, n2) {}
21 Number MulExpr::eval() const
23 return left()->eval() * right()->eval();
26 DivExpr::DivExpr(Expr* n1, Expr* n2) : BinExpr(n1, n2) {}
28 Number DivExpr::eval() const
30 return left()->eval() / right()->eval();