[antlr-interest] Re: Local lookahead depth
Oliver Zeigermann
oliver at zeigermann.de
Mon Nov 10 11:54:07 PST 2003
John D. Mitchell wrote:
>>>>>>"Oliver" == Oliver Zeigermann <oliver at zeigermann.de> writes:
>
> [...]
>
>
>>It describes a language with two words: 1.) SHORTWORD: exactly 1000 '*'
>>followed by a single '#' 2.) LONGWORD: exactly 10000 '*' followed by a
>>single '#'
>
>
>>While the are certainly other grammars that describe this language, this
>>one seems to be the most natural, but does not work, because semantic
>>predicates (like {cnt < 1000}?) rely on semantic actions ({ cnt++; }, {
>>cnt = 0; }).
>
>
> Do you really *need* to do that strictly in the parser? Why not just suck
> down a simpler language in the parser -- which recognizes any number of
> stars followed by a # -- and then do a more refined semantic check in a
> later stage. That would make for a much cleaner solution.
John, it seems we again have a communication problem. It is just an
example to illustrate something. I do not have a practical problem like
this. This is a *theoretical* discussion. I am talking *theory* all the
time :)
Oliver
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list