Home | History | Annotate | Download | only in Chapter7

Lines Matching refs:ExprAST

108 /// ExprAST - Base class for all expression nodes.
109 class ExprAST {
111 virtual ~ExprAST() {}
116 class NumberExprAST : public ExprAST {
124 class VariableExprAST : public ExprAST {
133 class UnaryExprAST : public ExprAST {
135 ExprAST *Operand;
137 UnaryExprAST(char opcode, ExprAST *operand)
143 class BinaryExprAST : public ExprAST {
145 ExprAST *LHS, *RHS;
147 BinaryExprAST(char op, ExprAST *lhs, ExprAST *rhs)
153 class CallExprAST : public ExprAST {
155 std::vector<ExprAST*> Args;
157 CallExprAST(const std::string &callee, std::vector<ExprAST*> &args)
163 class IfExprAST : public ExprAST {
164 ExprAST *Cond, *Then, *Else;
166 IfExprAST(ExprAST *cond, ExprAST *then, ExprAST *_else)
172 class ForExprAST : public ExprAST {
174 ExprAST *Start, *End, *Step, *Body;
176 ForExprAST(const std::string &varname, ExprAST *start, ExprAST *end,
177 ExprAST *step, ExprAST *body)
183 class VarExprAST : public ExprAST {
184 std::vector<std::pair<std::string, ExprAST*> > VarNames;
185 ExprAST *Body;
187 VarExprAST(const std::vector<std::pair<std::string, ExprAST*> > &varnames,
188 ExprAST *body)
224 ExprAST *Body;
226 FunctionAST(PrototypeAST *proto, ExprAST *body)
260 ExprAST *Error(const char *Str) { fprintf(stderr, "Error: %s\n", Str);return 0;}
264 static ExprAST *ParseExpression();
269 static ExprAST *ParseIdentifierExpr() {
279 std::vector<ExprAST*> Args;
282 ExprAST *Arg = ParseExpression();
301 static ExprAST *ParseNumberExpr() {
302 ExprAST *Result = new NumberExprAST(NumVal);
308 static ExprAST *ParseParenExpr() {
310 ExprAST *V = ParseExpression();
320 static ExprAST *ParseIfExpr() {
324 ExprAST *Cond = ParseExpression();
331 ExprAST *Then = ParseExpression();
339 ExprAST *Else = ParseExpression();
346 static ExprAST *ParseForExpr() {
360 ExprAST *Start = ParseExpression();
366 ExprAST *End = ParseExpression();
370 ExprAST *Step = 0;
381 ExprAST *Body = ParseExpression();
389 static ExprAST *ParseVarExpr() {
392 std::vector<std::pair<std::string, ExprAST*> > VarNames;
403 ExprAST *Init = 0;
426 ExprAST *Body = ParseExpression();
439 static ExprAST *ParsePrimary() {
454 static ExprAST *ParseUnary() {
462 if (ExprAST *Operand = ParseUnary())
469 static ExprAST *ParseBinOpRHS(int ExprPrec, ExprAST *LHS) {
484 ExprAST *RHS = ParseUnary();
503 static ExprAST *ParseExpression() {
504 ExprAST *LHS = ParseUnary();
581 if (ExprAST *E = ParseExpression())
588 if (ExprAST *E = ParseExpression()) {
868 ExprAST *Init = VarNames[i].second;