[antlr-interest] State Machines Galore

Jeff Barnes jbarnesweb at yahoo.com
Sat Jan 7 01:45:19 PST 2006


--- Terence Parr <parrt at cs.usfca.edu> wrote:

> > You said the following NFA generates (a | b | c):
> >
> > .s0 -> .a1 -> . -a-> . -> .s5 -> :
> >        .a2 -> . -b-> . -> @s5
> >        .a3 -> . -c-> . -> @s5
> > @a1 -> @a2
> > @a2 -> @a3
> >
> > What not use a simpler graph?
> >
> > .s0 -> .a1 -a-> .s5 -> :
> >        .a2 -b-> @s5
> >        .a3 -c-> @s5
> > @a1 -> @a2
> > @a2 -> @a3
> 
> You could...i was showing the output of another tool
> actually (ANTLR  
> v3) ;)


So it appears that ANTLR v3's parse tree isn't (a | b
| c) it is:

         |
        / \
       |   c
      / \
     a   b

and that tree is explicitly expressed in regular
expression as

((a | b) | c)

right?

Regards,
Jeff



More information about the antlr-interest mailing list