Lines Matching refs:ExprAST
109 /// ExprAST - Base class for all expression nodes.
110 class ExprAST {
112 virtual ~ExprAST() {}
117 class NumberExprAST : public ExprAST {
125 class VariableExprAST : public ExprAST {
134 class UnaryExprAST : public ExprAST {
136 ExprAST *Operand;
138 UnaryExprAST(char opcode, ExprAST *operand)
144 class BinaryExprAST : public ExprAST {
146 ExprAST *LHS, *RHS;
148 BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
154 class CallExprAST : public ExprAST {
156 std::vector<ExprAST*> Args;
158 CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
164 class IfExprAST : public ExprAST {
165 ExprAST *Cond, *Then, *Else;
167 IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
173 class ForExprAST : public ExprAST {
175 ExprAST *Start, *End, *Step, *Body;
177 ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
178 ExprAST *step, ExprAST *body)
184 class VarExprAST : public ExprAST {
185 std::vector<std::pair<std::string, ExprAST*> > VarNames;
186 ExprAST *Body;
188 VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
189 ExprAST *body)
225 ExprAST *Body;
227 FunctionAST(PrototypeAST *proto, ExprAST *body)
262 ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
266 static ExprAST *ParseExpression();
271 static ExprAST *ParseIdentifierExpr() {
281 std::vector<ExprAST*> Args;
284 ExprAST *Arg = ParseExpression();
303 static ExprAST *ParseNumberExpr() {
304 ExprAST *Result = new NumberExprAST(NumVal);
310 static ExprAST *ParseParenExpr() {
312 ExprAST *V = ParseExpression();
322 static ExprAST *ParseIfExpr() {
326 ExprAST *Cond = ParseExpression();
333 ExprAST *Then = ParseExpression();
341 ExprAST *Else = ParseExpression();
348 static ExprAST *ParseForExpr() {
362 ExprAST *Start = ParseExpression();
368 ExprAST *End = ParseExpression();
372 ExprAST *Step = 0;
383 ExprAST *Body = ParseExpression();
391 static ExprAST *ParseVarExpr() {
394 std::vector<std::pair<std::string, ExprAST*> > VarNames;
405 ExprAST *Init = 0;
428 ExprAST *Body = ParseExpression();
441 static ExprAST *ParsePrimary() {
456 static ExprAST *ParseUnary() {
464 if (ExprAST *Operand = ParseUnary())
471 static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
486 ExprAST *RHS = ParseUnary();
505 static ExprAST *ParseExpression() {
506 ExprAST *LHS = ParseUnary();
583 if (ExprAST *E = ParseExpression())
590 if (ExprAST *E = ParseExpression()) {
870 ExprAST *Init = VarNames[i].second;