Let's stop parser Hell

David Piepgrass qwertie256 at gmail.com
Sat Jul 7 14:09:22 PDT 2012


> Since I didn't understand your question I assume that my 
> statement was somehow incorrect (likely because I made some 
> wrong assumptions about ANTLR). I didn't know about its 
> existence until today and still don't understand it completely. 
> What I think I understood is that it uses DFA for deciding 
> which grammar rule to apply instead of doing backtracking. I 
> also think that it uses DFA for low-level scanning (I'm not 
> sure).

ANTLR 3 doesn't use a DFA unless it needs to. If unlimited 
lookahead is not called for, it uses standard LL(k) or perhaps it 
uses the modified (approximate? I forget the name) LL(k) from 
ANTLR 2. DFA comes into play, for instance, if you need to check 
what comes after an argument list (of, unlimited, length) before 
you can decide that it *is* an argument list and start the "real" 
parsing (The author says LL(k) is too inefficient so he used a 
restricted form of it; personally I'm not convinced, but I 
digress)


More information about the Digitalmars-d mailing list