[antlr-interest] not parsing to end of input

Mark Volkmann r.mark.volkmann at gmail.com
Mon Dec 10 12:35:53 PST 2007


On Dec 10, 2007 11:27 AM, Tom Smith <yotommy at gmail.com> wrote:
> When I ran this through the ANTLRworks debugger, it parsed all the
> input properly.
>
> When you invoked "Debug" are you selecting the 'script' rule as the start rule?

No, I didn't. That was my problem for this small grammar. However,
there is still a problem with my larger grammar. I'll try again to
reduce it to something smaller that exhibits the problem and send it
out again. Thanks for looking at this!

> On Dec 10, 2007 12:08 PM, Mark Volkmann <r.mark.volkmann at gmail.com> wrote:
> > I've stripped down my grammar to the smallest size that reproduces the
> > problem. When I run "print x;" through this grammar using the
> > ANTLRWorks debugger, it doesn't process the semicolon. It stops
> > parsing at that point and throws the rest of the input away. In my
> > real grammar this ends up being multiple lines of lost input. Any idea
> > what I'm doing wrong?
> >
> > grammar problem;
> >
> > options {
> >   output = AST;
> > }
> >
> > script: print ';';
> > print: 'print' LETTER -> ^('print');
> >
> > LETTER: 'a'..'z';
> > WHITESPACE: ' '+ { $channel = HIDDEN; };

-- 
R. Mark Volkmann
Object Computing, Inc.


More information about the antlr-interest mailing list