// prod_op -> MULTDIV factor prod_op
// prod_op -> EPSILON
private ExpressionNode prodOperation(ExpressionNode expression) {
// prod_op -> MULTDIV factor prod_op
if (lookahead.tokenType == TokenTypes.MULTIPLICATION) {
MultiplicationExpressionNode prod;
// This means we are actually dealing with a product
// If expr is not already a product, we have to create one
if (expression.getType() == TokenTypes.MULTIPLICATION) {
prod = (MultiplicationExpressionNode) expression;
} else {
prod = new MultiplicationExpressionNode(expression, true);
}
// reduce the input and recursively call prod_op
boolean positive = lookahead.sequence.equals("*");
nextToken();
ExpressionNode factor = factor();
prod.add(factor, positive);
return prodOperation(prod);
}
// prod_op -> EPSILON