public static int putClass(String c, boolean p, String sc) { Name cName = Type.getName(c); if ((cName != null) && !Name.isForward(c)) { push(); push(); return 1; } else { Name scName = Type.getName(sc); if (scName == null) { push(); push(); return 2; } else { push(scName.getEnv()); Env current = top; push(); cName = Type.putName(c, sc, top); Symb s = new Symb(cName, cName, p); current.table.put(c, s); System.out.println(" PUT " + c + " IN " + current); root.table.put(c, s); System.out.println(" PUT " + c + " IN " + root); return 0; } } }
public static void initFirst() { envCounter = 0; newEnvs.add(envCounter, root); top = (Env) newEnvs.get(envCounter); put("printf", new Symb(Type.method(Type.voidtype(), Type.voidtype()), null, true)); put("scanf", new Symb(Type.method(Type.voidtype(), Type.voidtype()), null, true)); System.out.println(" " + top); }