static void Designator(out DesType des) { string name; int indexType; Ident(out name); Entry entry = Table.Find(name); if (!entry.declared) { SemError("undeclared identifier"); } des = new DesType(entry); if (entry.kind == Kinds.Var) { CodeGen.LoadAddress(entry); } if (la.kind == lbrack_Sym) { Get(); if (IsArray(des.type)) { des.type--; } else { SemError("unexpected subscript"); } if (des.entry.kind != Kinds.Var) { SemError("unexpected subscript"); } CodeGen.Dereference(); Expression(out indexType); if (!IsArith(indexType)) { SemError("invalid subscript type"); } CodeGen.Index(); Expect(rbrack_Sym); } }