Lines Matching defs:ExprAST

126 /// ExprAST - Base class for all expression nodes.
127 class ExprAST {
129 virtual ~ExprAST() {}
134 class NumberExprAST : public ExprAST {
142 class VariableExprAST : public ExprAST {
151 class UnaryExprAST : public ExprAST {
153 ExprAST *Operand;
155 UnaryExprAST(char opcode, ExprAST *operand)
161 class BinaryExprAST : public ExprAST {
163 ExprAST *LHS, *RHS;
165 BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
171 class CallExprAST : public ExprAST {
173 std::vector<ExprAST*> Args;
175 CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
181 class IfExprAST : public ExprAST {
182 ExprAST *Cond, *Then, *Else;
184 IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
190 class ForExprAST : public ExprAST {
192 ExprAST *Start, *End, *Step, *Body;
194 ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
195 ExprAST *step, ExprAST *body)
201 class VarExprAST : public ExprAST {
202 std::vector<std::pair<std::string, ExprAST*> > VarNames;
203 ExprAST *Body;
205 VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
206 ExprAST *body)
242 ExprAST *Body;
244 FunctionAST(PrototypeAST *proto, ExprAST *body)
278 ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
282 static ExprAST *ParseExpression();
287 static ExprAST *ParseIdentifierExpr() {
297 std::vector<ExprAST*> Args;
300 ExprAST *Arg = ParseExpression();
319 static ExprAST *ParseNumberExpr() {
320 ExprAST *Result = new NumberExprAST(NumVal);
326 static ExprAST *ParseParenExpr() {
328 ExprAST *V = ParseExpression();
338 static ExprAST *ParseIfExpr() {
342 ExprAST *Cond = ParseExpression();
349 ExprAST *Then = ParseExpression();
357 ExprAST *Else = ParseExpression();
364 static ExprAST *ParseForExpr() {
378 ExprAST *Start = ParseExpression();
384 ExprAST *End = ParseExpression();
388 ExprAST *Step = 0;
399 ExprAST *Body = ParseExpression();
407 static ExprAST *ParseVarExpr() {
410 std::vector<std::pair<std::string, ExprAST*> > VarNames;
421 ExprAST *Init = 0;
444 ExprAST *Body = ParseExpression();
457 static ExprAST *ParsePrimary() {
472 static ExprAST *ParseUnary() {
480 if (ExprAST *Operand = ParseUnary())
487 static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
502 ExprAST *RHS = ParseUnary();
521 static ExprAST *ParseExpression() {
522 ExprAST *LHS = ParseUnary();
599 if (ExprAST *E = ParseExpression())
606 if (ExprAST *E = ParseExpression()) {
896 ExprAST *Init = VarNames[i].second;