Blang/src/lib/src/Statement/BinaryOperatorExpr.h

42 lines
800 B
C++

#ifndef BLANG_BINARYOPERATOREXPR_H
#define BLANG_BINARYOPERATOREXPR_H
#include <map>
#include "Expr.hpp"
class BinaryOperatorExpr: public Expr
{
public:
enum Opcode {
#define BINARY_OPERATION(Name, Spelling) BO_##Name,
#include "OperationKinds.def"
};
BinaryOperatorExpr(Expr *lhs, Expr *rhs, Opcode opc);
Expr *getLHS () const;
void setLHS (Expr *E);
Expr *getRHS () const;
void setRHS (Expr *E);
Opcode getOpcode() const;
void setOpcode (Opcode O);
std::string getOpcodeStr() const;
static std::string getOpcodeStr(Opcode opc);
static Opcode getStrOpcode(std::string str);
private:
Opcode _opc;
enum ExprIdentifier
{
LHS, RHS
};
std::map<ExprIdentifier, Expr*> _subExprs;
};
#endif //BLANG_BINARYOPERATOREXPR_H