sclass LCLongerProds { LS literals; new TreeMap> productions; Map> files; S itemToString(int idx) { new StringBuilder buf; itemToString_step(buf, idx); ret str(buf); } void itemToString_step(StringBuilder buf, int idx) { if (idx < l(literals)) buf.append(literals.get(idx)); else for (int i : productions.get(idx)) itemToString_step(buf, i); } }