[antlr-interest] ANTLR NUB

Jan Nielsen jan.sture.nielsen at gmail.com
Tue Jan 29 12:53:42 PST 2008


On Jan 29, 2008 12:05 PM, John B. Brodie <jbb at acm.org> wrote:
> Greetings!
>
> Jan Nielsen wrote:
> >So I rewrote the grammar with return values after implementing the
> >underlying APIs. I'm still having some basic issues with recognition,
> >however. I think the excludeClause and includeClause lists are not
> >being handled correctly - perhaps because of the comma?
>
> The handling of the comma in excludeClause and includeClause looks
> okay to me.

Okay.

>
> >I have included my test cases and grammar below. If you have any
> >insights about what I've done wrong, I'd be delighted to entertain
> >them. :)
>
> monthClause REQUIRES a '/' before the name of the month. so the test
> input of "include June to July" will be illegal. according to the
> grammar that should instead be "include /June to /July".

Ahh - right you are! And I did a similar error with startDate and endDate.

> as for the other errors, I am really confused. is your test rig
> proper? since your grammar only handles a single availablityClause you
> should be starting with a brand new fresh lexer and parser for each of
> your inputs, right?

Yes; I create a new lexer and parser for each availability line in my
test rig - I should have made that clear. But I've change to process
multiple availabilityClauses now from a file with EOF at the end:

  program : availabilityClause+ EOF;

And things are now working. Now on to handling errors more gracefully...

Many thanks for your help!


-Jan


More information about the antlr-interest mailing list