public Node ParseFactor() { Node left = ParseGetAndCall(); while (match(TokenType.STAR, TokenType.SLASH)) { Token op = previous(); Node right = ParseGetAndCall(); left = new BinaryOpNode(left, right, op); } return(left); }
public Node ParseTerm() { Node left = ParseFactor(); while (match(TokenType.PLUS, TokenType.MINUS)) { Token op = previous(); Node right = ParseFactor(); left = new BinaryOpNode(left, right, op); } return(left); }
public Node ParseEquals() { Node left = ParseComparison(); while (match(TokenType.EQUAL_EQUAL, TokenType.BANG_EQUAL)) { Token op = previous(); Node right = ParseComparison(); left = new BinaryOpNode(left, right, op); } return(left); }
public Node ParseComparison() { Node left = ParseTerm(); while (match(TokenType.GREATER, TokenType.GREATER_EQUAL, TokenType.LESS, TokenType.LESS_EQUAL)) { Token op = previous(); Node right = ParseTerm(); left = new BinaryOpNode(left, right, op); } return(left); }
public Node ParseAnd() { Node left = ParseEquals(); while (match(TokenType.AND)) { Token op = previous(); Node right = ParseEquals(); left = new BinaryOpNode(left, right, op); } return(left); }