Exemple #1
0
        void MOperand(Instruction inst)
        {
            bool p = false, ff = false; int?val = null; string tt = "w";

            if (la.kind == 7)
            {
                Get();
                p = true;
            }
            if (la.kind == 1 || la.kind == 2 || la.kind == 8)
            {
                if (la.kind == 8)
                {
                    Get();
                    ff = true;
                }
                Constant(ref val);
            }
            else if (la.kind == 6)
            {
                Stack(ref val);
            }
            else
            {
                SynErr(27);
            }
            if (la.kind == 9)
            {
                Get();
                if (la.kind == 10)
                {
                    Get();
                }
                else if (la.kind == 11)
                {
                    Get();
                }
                else if (la.kind == 12)
                {
                    Get();
                }
                else
                {
                    SynErr(28);
                }
                tt = t.val;
                Expect(13);
            }
            if (val == null)
            {
                inst.Operands.Add(VOperand.FromStack(TypeDec(tt), p));
            }
            else
            {
                inst.Operands.Add(VOperand.FromNumber(val.Value, TypeDec(tt), p, ff));
            }
        }
Exemple #2
0
        void LOperand(Instruction inst)
        {
            bool p = false; string lb; string tt = "w";

            if (la.kind == 14)
            {
                Get();
            }
            else if (la.kind == 15)
            {
                Get();
                p = true;
            }
            else
            {
                SynErr(29);
            }
            Expect(4);
            lb = t.val;
            if (la.kind == 9)
            {
                Get();
                if (la.kind == 10)
                {
                    Get();
                }
                else if (la.kind == 11)
                {
                    Get();
                }
                else if (la.kind == 12)
                {
                    Get();
                }
                else
                {
                    SynErr(30);
                }
                tt = t.val;
                Expect(13);
            }
            inst.Operands.Add(VOperand.FromLabel(lb, TypeDec(tt), p));
        }