private Expr ParseLeftAssociativeBinaryOperation( Func <Expr> higherPrecedence, params TokenType[] tokenTypes) { var expr = higherPrecedence(); while (Match(tokenTypes)) { var op = Previous(); var right = higherPrecedence(); expr = new Expr.Binary(expr, op, right); } return(expr); }
public string VisitBinaryExpr(Expr.Binary expr) { return(Parenthesize(expr.Operator.Lexeme, expr.Left, expr.Right)); }
public object VisitBinaryExpr(Expr.Binary expr) { Resolve(expr.Left); Resolve(expr.Right); return(null); }