Main { public static void main(String[] argv) (@ try { TypeRegistry registry = TypeRegistry.parse(System.in); registry.display(); } catch(ParseError e){ System.out.println(e.getMessage()); System.exit(1); } @) } TypeRegistry{ public void display() to BasicType { before BasicType (@ host.display(); @) } } BasicType { (@ // Can't use the name 'parse' becuase derived concrete classes will // define that method themselves. public static BasicType parseBasicType(java.io.InputStream in) throws ParseError { return new Parser(in)._BasicType(); } public static BasicType parseBasicType(String s) { try { return parseBasicType(new java.io.ByteArrayInputStream(s.getBytes())); } catch (ParseError e) { throw new RuntimeException(e.toString()); } } public void display() { PrintWriter pw = new PrintWriter(System.out); universal_trv0(new DisplayVisitor(pw)); pw.flush(); System.out.println(); } @) }