コード例 #1
0
        // Operator         ::=	+ | - | * | / | < | > | =
        Operate parseOperator()
        {
            if (CurrentToken == null)
            {
                return(null);
            }
            Operate O = new Operate(CurrentToken.getSpelling());

            accept(Operator);
            return(O);
        }
コード例 #2
0
        // ============================================================================================================
        // 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);
        }
コード例 #3
0
 public Expression(PrimaryExpression P1, Operate O, PrimaryExpression P2)
 {
     this.P1 = P1;
     this.O  = O;
     this.P2 = P2;
 }