[antlr-interest] needed: grammar to provoke multiple cyclicDFAs

Terence Parr parrt at cs.usfca.edu
Mon Dec 26 11:03:58 PST 2005


On Dec 24, 2005, at 5:19 PM, Kay Roepke wrote:

> Hi!
>
> For testing purposes I want to have a rather simple lexer grammar  
> which will generate two cyclicDFAs to be used.
> At the moment I'm at a loss to produce such a grammar.
>
> Does anyone have an idea? Or is that not possible?
> Everything I tried to throw at ANTLR seems to end up in one DFA...

You need two rules, each with a cyclic DFA.  Prefix with x and z to  
make Tokens rule acyclic.

X : 'x' ('y'+ 'a'|'y'+ 'b') ;

Z : 'z' ('y'+ 'a'|'y'+ 'b') ;

that might work :)

Ter


More information about the antlr-interest mailing list