// Operator ::= + | - | * | / | < | > | = Operate parseOperator() { if (CurrentToken == null) { return(null); } Operate O = new Operate(CurrentToken.getSpelling()); accept(Operator); return(O); }
// ============================================================================================================ // Expression ::= PrimaryExpression Operator PrimaryExpression Expression parseExpression() { Expression expression; if (CurrentToken == null) { return(null); } PrimaryExpression P1 = parsePrimary(); Operate O = parseOperator(); PrimaryExpression P2 = parsePrimary(); expression = new Expression(P1, O, P2); return(expression); }
public Expression(PrimaryExpression P1, Operate O, PrimaryExpression P2) { this.P1 = P1; this.O = O; this.P2 = P2; }