Esempio n. 1
0
        static void Expression(out int type)
        {
            int  type2;
            int  op;
            bool comparable;

            AddExp(out type);
            if (StartOf(10))
            {
                RelOp(out op);
                AddExp(out type2);
                switch (op)
                {
                case CodeGen.ceq:
                case CodeGen.cne:
                    comparable = Compatible(type, type2);
                    break;

                default:
                    comparable = IsArith(type) && IsArith(type2);
                    break;
                }
                if (!comparable)
                {
                    SemError("incomparable operands");
                }
                type = Types.boolType; CodeGen.Comparison(op);
            }
        }