Ejemplo n.º 1
0
        static void ReadElement()
        {
            string  str;
            DesType des;

            if (la.kind == stringLit_Sym)
            {
                StringConst(out str);
                CodeGen.WriteString(str);
            }
            else if (la.kind == identifier_Sym)
            {
                Designator(out des);
                if (des.entry.kind != Kinds.Var)
                {
                    SemError("wrong kind of identifier");
                }
                switch (des.type)
                {
                case Types.intType:
                case Types.boolType:
                    CodeGen.Read(des.type); break;

                default:
                    SemError("cannot read this type"); break;
                }
            }
            else
            {
                SynErr(53);
            }
        }