[antlr-interest] ANTLR 3: Problem with static DFA class generation

Oliver Zeigermann oliver.zeigermann at gmail.com
Mon Sep 19 08:26:40 PDT 2005


2005/9/19, Terence Parr <parrt at cs.usfca.edu>:
> 
> On Sep 19, 2005, at 2:22 AM, Oliver Zeigermann wrote:
> >>>
> >>> class XMLLexer extends Lexer {
> >>>
> >>> ...
> >>>
> >>> private dfa10 = new DFA10();
> >>>
> >>> ...
> >>>
> >>> alt10 = dfa10.predict(input);
> >>>
> >>> ...
> >>>
> >>> }
> >>>
> >>
> > Yes, that's right! My patch does not include the above single
> > construction, as this would have required a bit more than changing a
> > template, though. But I am pretty sure that you know how to do this...
> 
> Actually, should only require a template chnage.  The list of DFAs is
> known to the overall lexer template and so it can apply a small
> template to each DFA, generating the private reused instance. :)

Well, I had to add more than a template change as seen in my patch I
sent. But just a few lines in CodeGenerator.

Maybe you have a better solution?!

Oliver


More information about the antlr-interest mailing list