private Node expr() { Node left = term(); while (currentToken.type == Token.ADD | currentToken.type == Token.SUB) { Node node = new BinOpNode(currentToken); nextToken(); node.addChild(left); node.addChild(term()); left = node; } return(left); }
private Node term() { Node left = factor(); while (currentToken.type == Token.MUL | currentToken.type == Token.DIV | currentToken.type == Token.LT | currentToken.type == Token.AND | currentToken.type == Token.EQ) { Node node = new BinOpNode(currentToken); nextToken(); node.addChild(left); node.addChild(factor()); left = node; } return(left); }