public static Pgen parsePGEN(Reader r) throws SyntaxError {
Pgen parsedg;
DefaultTranslationMapper mapper = new DefaultTranslationMapper() ;
Grammar g ;
mapper.addTranslation(new Rule(FILE),new CreateGrammarTrans()) ;
mapper.addTranslation(new Rule(FILE,FILE,TYPE,GENERIC_TYPE,SYMLIST,";"),new AddTypeTrans()) ;
mapper.addTranslation(new Rule(FILE,FILE,RULEDEF),new AddRuleDefToFile()) ;
mapper.addTranslation(new Rule(FILE,FILE,"(",RULEBLOCK,")"),new AddEquPrecToFile()) ;
mapper.addTranslation(new Rule(FILE,FILE,START,SYM),new CreateStartTrans()) ;
mapper.addTranslation(new Rule(FILE,FILE,EXTEND,GENERIC_TYPE),new ExtendsTrans()) ;
mapper.addTranslation(new Rule(FILE,FILE,IMPORT,JAVATYPE),new ImportTrans()) ;
mapper.addTranslation(new Rule(FILE,FILE,IMPORT,JAVATYPE,".","*"),new ImportTransStar()) ;
mapper.addTranslation(new Rule(FILE,FILE,AMBIG),new Ambig()) ;
mapper.addTranslation(new Rule(RULEBLOCK),new EmptyRuleBlock()) ;
mapper.addTranslation(new Rule(RULEBLOCK,RULEBLOCK,RULEDEF),new AddRuleDef()) ;
mapper.addTranslation(new Rule(RULEDEF,SYM,":",RHS,";"),new CreateRuleTrans()) ;
mapper.addTranslation(new Rule(ATTRS),new NewAttrTrans()) ;
mapper.addTranslation(new Rule(ATTRS,NON),new AddNoneTrans()) ;
mapper.addTranslation(new Rule(ATTRS,LEFT),new AddLeftTrans()) ;
mapper.addTranslation(new Rule(ATTRS,RIGHT),new AddRightTrans()) ;
mapper.addTranslation(new Rule(RHS),new EmptyRhsTrans()) ;
mapper.addTranslation(new Rule(RHS,RHS,CODE,VAR_OPT),new BuildNoTrans()) ;
mapper.addTranslation(new Rule(RHS,RHS,SYM,ATTRS,VAR_OPT),new BuildRhsTrans()) ;
mapper.addTranslation(new Rule(SYMLIST),new EmptySymList()) ;
mapper.addTranslation(new Rule(SYMLIST,SYMLIST,SYM),new BuildSymList()) ;
mapper.addTranslation(new Rule(SYM,QUOTEDSTRING),new MakeIdTrans()) ;
mapper.addTranslation(new Rule(SYM,ID),new MakeIdTrans()) ;
mapper.addTranslation(new Rule(VAR_OPT),new EmptyVar()) ;
mapper.addTranslation(new Rule(VAR_OPT,"=",ID),new IdVar()) ;
mapper.addTranslation(new Rule(JAVATYPE,ID),new TypeFromId()) ;
mapper.addTranslation(new Rule(JAVATYPE,JAVATYPE,".",ID),new TypeByConstruction()) ;
mapper.addTranslation(new Rule(GENERIC_TYPE,JAVATYPE),new SimpleType()) ;
mapper.addTranslation(new Rule(GENERIC_TYPE,JAVATYPE,GENERIC),new GenericType()) ;
try {
g = new Grammar(S,new ConcatCollection<Rule>(mapper.rules.keySet(),new Rule(S,FILE)),new Tree23Map<String,AssocType>(),
new Tree23Map<String,Integer>(),
new Tree23Map<Rule,Integer>()) ;
} catch (InvalidStartRule e) {
throw new RuntimeException(e) ;
} catch (StrandedSymbol e) {