Lines Matching defs:ExprAST

110 /// ExprAST - Base class for all expression nodes.
111 class ExprAST {
113 virtual ~ExprAST() {}
118 class NumberExprAST : public ExprAST {
126 class VariableExprAST : public ExprAST {
135 class UnaryExprAST : public ExprAST {
137 ExprAST *Operand;
139 UnaryExprAST(char opcode, ExprAST *operand)
145 class BinaryExprAST : public ExprAST {
147 ExprAST *LHS, *RHS;
149 BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
155 class CallExprAST : public ExprAST {
157 std::vector<ExprAST*> Args;
159 CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
165 class IfExprAST : public ExprAST {
166 ExprAST *Cond, *Then, *Else;
168 IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
174 class ForExprAST : public ExprAST {
176 ExprAST *Start, *End, *Step, *Body;
178 ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
179 ExprAST *step, ExprAST *body)
185 class VarExprAST : public ExprAST {
186 std::vector<std::pair<std::string, ExprAST*> > VarNames;
187 ExprAST *Body;
189 VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
190 ExprAST *body)
226 ExprAST *Body;
228 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()) {
1119 ExprAST *Init = VarNames[i].second;