}
}
static public Grammar parseGrammar(SrcReader reader, Log log) throws IOException, Parser.Exception, Grammar.Exception
{
GrammarTreeRoot root = (GrammarTreeRoot) new GrammarParser(log).parse(new GrammarScanner(reader));
if (log.hasErrors())
throw new Grammar.Exception("cannot parse grammar");
GrammarBuilder maker = new GrammarBuilder(log);
root.accept(maker);
return maker.getGrammar();
}