static void Arguments(DesType des) { int argCount = 0; Entry fp = des.entry.firstParam; if (StartOf(11)) { OneArg(fp); argCount++; if (fp != null) { fp = fp.nextInScope; } while (WeakSeparator(comma_Sym, 11, 2)) { OneArg(fp); argCount++; if (fp != null) { fp = fp.nextInScope; } } } if (argCount != des.entry.nParams) { SemError("wrong number of arguments"); } }
} // Assignable static bool IsCall(out DesType des) { // Used as an LL(1) conflict resolver variable/function name Entry entry = Table.Find(la.val); des = new DesType(entry); return(entry.kind == Kinds.Fun); } // IsCall
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); } }