Lines Matching defs:ExprAST

112 /// ExprAST - Base class for all expression nodes.
113 class ExprAST {
115 virtual ~ExprAST() {}
120 class NumberExprAST : public ExprAST {
128 class VariableExprAST : public ExprAST {
137 class UnaryExprAST : public ExprAST {
139 ExprAST *Operand;
141 UnaryExprAST(char opcode, ExprAST *operand)
147 class BinaryExprAST : public ExprAST {
149 ExprAST *LHS, *RHS;
151 BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
157 class CallExprAST : public ExprAST {
159 std::vector<ExprAST*> Args;
161 CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
167 class IfExprAST : public ExprAST {
168 ExprAST *Cond, *Then, *Else;
170 IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
176 class ForExprAST : public ExprAST {
178 ExprAST *Start, *End, *Step, *Body;
180 ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
181 ExprAST *step, ExprAST *body)
187 class VarExprAST : public ExprAST {
188 std::vector<std::pair<std::string, ExprAST*> > VarNames;
189 ExprAST *Body;
191 VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
192 ExprAST *body)
228 ExprAST *Body;
230 FunctionAST(PrototypeAST *proto, ExprAST *body)
264 ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
268 static ExprAST *ParseExpression();
273 static ExprAST *ParseIdentifierExpr() {
283 std::vector<ExprAST*> Args;
286 ExprAST *Arg = ParseExpression();
305 static ExprAST *ParseNumberExpr() {
306 ExprAST *Result = new NumberExprAST(NumVal);
312 static ExprAST *ParseParenExpr() {
314 ExprAST *V = ParseExpression();
324 static ExprAST *ParseIfExpr() {
328 ExprAST *Cond = ParseExpression();
335 ExprAST *Then = ParseExpression();
343 ExprAST *Else = ParseExpression();
350 static ExprAST *ParseForExpr() {
364 ExprAST *Start = ParseExpression();
370 ExprAST *End = ParseExpression();
374 ExprAST *Step = 0;
385 ExprAST *Body = ParseExpression();
393 static ExprAST *ParseVarExpr() {
396 std::vector<std::pair<std::string, ExprAST*> > VarNames;
407 ExprAST *Init = 0;
430 ExprAST *Body = ParseExpression();
443 static ExprAST *ParsePrimary() {
458 static ExprAST *ParseUnary() {
466 if (ExprAST *Operand = ParseUnary())
473 static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
488 ExprAST *RHS = ParseUnary();
507 static ExprAST *ParseExpression() {
508 ExprAST *LHS = ParseUnary();
585 if (ExprAST *E = ParseExpression())
592 if (ExprAST *E = ParseExpression()) {
879 ExprAST *Init = VarNames[i].second;