sencha-lang/Sencha-lang/AST/BasicExpression.h

42 lines
1021 B
C++

/*
* BasicExpression.h
*
* Created on: Dec 5, 2012
* Author: attero
*/
#ifndef BASICEXPRESSION_H_
#define BASICEXPRESSION_H_
#include "ASTExpression.h"
#include <iostream>
/**
* BasicExpression is a very important class in my AST design. It always has
* two children, which are actually left and right operands. Basic expression stores
* a type of operation it does. It can be "+" or "-" for example.
* Type of operator is very important when expression evaluates itself.
*
*/
class BasicExpression : public ASTExpression {
public:
void set_operator(std::string op);
void set_left_operand(ASTNode * left);
void set_right_operand(ASTNode * right);
virtual SenchaObject evaluate();
virtual void execute();
virtual void execute_quietly();
std::string get_operator() { return oper; }
virtual void accept(Visitor * visitor);
BasicExpression();
virtual ~BasicExpression();
private:
//Do I use it for anything actually?
bool children_set;
std::string oper;
};
#endif /* BASICEXPRESSION_H_ */