Beispiel #1
0
        void RelationExp(out Expression e)
        {
            Expression e2; Operator op;

            AddExp(out e);
            while (StartOf(3))
            {
                if (la.kind == 25)
                {
                    Get();
                    op = Operator.Lt;
                }
                else if (la.kind == 26)
                {
                    Get();
                    op = Operator.Gt;
                }
                else if (la.kind == 27)
                {
                    Get();
                    op = Operator.Le;
                }
                else
                {
                    Get();
                    op = Operator.Ge;
                }
                AddExp(out e2);
                e = new BinOp(op, e, e2);
            }
        }
Beispiel #2
0
        void LogAndExp(out Expression e)
        {
            Expression e2;

            EqualExp(out e);
            while (la.kind == 22)
            {
                Get();
                EqualExp(out e2);
                e = new BinOp(Operator.And, e, e2);
            }
        }
Beispiel #3
0
        void LogOrExp(out Expression e)
        {
            Expression e2;

            LogAndExp(out e);
            while (la.kind == 21)
            {
                Get();
                LogAndExp(out e2);
                e = new BinOp(Operator.Or, e, e2);
            }
        }
Beispiel #4
0
        void MultExp(out Expression e)
        {
            Expression e2; Operator op;

            UnaryExp(out e);
            while (la.kind == 18 || la.kind == 31)
            {
                if (la.kind == 18)
                {
                    Get();
                    op = Operator.Mul;
                }
                else
                {
                    Get();
                    op = Operator.Div;
                }
                UnaryExp(out e2);
                e = new BinOp(op, e, e2);
            }
        }
Beispiel #5
0
        void AddExp(out Expression e)
        {
            Expression e2; Operator op;

            MultExp(out e);
            while (la.kind == 29 || la.kind == 30)
            {
                if (la.kind == 29)
                {
                    Get();
                    op = Operator.Add;
                }
                else
                {
                    Get();
                    op = Operator.Sub;
                }
                MultExp(out e2);
                e = new BinOp(op, e, e2);
            }
        }
Beispiel #6
0
        void EqualExp(out Expression e)
        {
            Expression e2; Operator op;

            RelationExp(out e);
            while (la.kind == 23 || la.kind == 24)
            {
                if (la.kind == 23)
                {
                    Get();
                    op = Operator.Eq;
                }
                else
                {
                    Get();
                    op = Operator.Ne;
                }
                RelationExp(out e2);
                e = new BinOp(op, e, e2);
            }
        }