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

37 lines
870 B
C
Raw Normal View History

2012-12-05 19:32:43 +00:00
/*
* 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.
*
*/
2012-12-05 19:32:43 +00:00
class BasicExpression : public ASTExpression {
public:
virtual SenchaObject evaluate();
virtual SenchaObject execute();
2012-12-21 15:21:49 +00:00
std::string get_operator() { return oper; }
virtual void accept(Visitor * visitor);
BasicExpression(ASTNode * left, ASTNode * right, std::string oper);
2012-12-05 19:32:43 +00:00
virtual ~BasicExpression();
2012-12-21 15:21:49 +00:00
private:
std::string oper;
2012-12-05 19:32:43 +00:00
};
#endif /* BASICEXPRESSION_H_ */