[antlr-interest] Grammar.createLookaheadDFA(): could not even do k=1 for decision 45;

Erik Kratochvil discontinuum at gmail.com
Thu Feb 7 00:32:56 PST 2008


Indeed, writing the grammar from scratch would be the best solution :)

The enormous size of parser was caused by huge number of syntactic
predicates (or backtrack=true) toghether with k = *. In most rules,
left-factoring, reducing the number of predicates, and reducing the
lookahead to 2 fixed the problem with the createLookaheadDFA(). After
that, the size of parser was back to 2.6M with k=2 and 3.0M with k=*.

Thank you for your advice, I've found it most helpful.


On 2/6/08, Jim Idle <jimi at temporal-wave.com> wrote:
> You may well find that rather than using the existing grammar as your
> guide, it is easier to start with a blank screen and build up to the
> full grammar using 3.x constructs. As you add new productions, you will
> be able to see which of them are causing ambiguities and diagnose them
> as either grammar problems which you can refactor, or real language
> ambiguities which require a little more ingenuity.

-- 
Erik Kratochvíl


More information about the antlr-interest mailing list