[antlr-interest] Help needed with LL(*)-type grammar

Florian fvwalter at web.de
Wed Feb 10 06:59:25 PST 2010


Hi, John,

thanks for the hint with the "fragment"! That was the reason why it
didn't work.
I copied over the "fragment" from some example but forgot about it.


On 09.02.2010 18:09, John B. Brodie wrote:
> [...]
> Greetings!
>
> you have the meta-keyword `fragment` on your INT lexer rule.
> this means that the lexer will *NEVER* recognize an INT for the parser.
> so the parser never sees a recordCount and fails. see below.
>
>
> but now you might have a problem with fieldData. can fieldData be an
> INT? if so how are you supposed to distinguish an arbitrary occurance of
> a sequence of digits between either a recordCount or a fieldData. that
> is, is something like "Obj1^Verb1^1^2^Obj2^Verb1^field^" legal? hope
> not...
>
> hopefully you can find a more restrictive definition of fieldData that
> distinguishes it from a recordCount -- like maybe, hopefully, fieldData
> has to start with something other than a digit? 
>   

No, unfortunately there is no more strict definition of fieldData.
But it looks like it works since the parser can match along the
combination of objectName and verbName and therefore distinguish where
the difference between a fieldData and a recordCount is.

Thanks again!

Best regards,
Florian


More information about the antlr-interest mailing list