[antlr-interest] Re: Local lookahead depth

John D. Mitchell johnm-antlr at non.net
Mon Nov 10 10:37:00 PST 2003


>>>>> "Oliver" == Oliver Zeigermann <oliver at zeigermann.de> writes:

[...necessity of guarded predicates...]

> Still can not remember my example, but here is some illustration that
> there really are languages that can not be parsed without that extension:

> 1.) Using semantic predicates you can increase the set of parseable
> languages. This is easy to see when you think of the symbol table stuff:
> in some programming languages undeclared variables are invalid and thus
> the programm you have written is. This way you have a stronger device to
> tell the words in your languages from those that are not.  2.) A bit less
> obvious: As I had to admit, persuaded by Terence, for every lookahead k >
> 0 there are languages that can be parsed with LL(k), but not with
> LL(k-1). This means no matter how big a fixed k is there still is an
> infinite number of languages that can not be parsed with LL(k), but still
> can with syntactic predicates.

> Now, imagine a language that is so weird it needs full syntactic
> predicated lookahead and additionally has context-sensitive features.
> This means the symbol table must be *set* and checked inside syntactic
> predicates.

> If you can not set the symbol table, you can not parse a language, you
> otherwise could. Thus this stuff augments the set of parseable languages
> with ANTLR.

You still haven't shown how the "guarded predicates" are *necessary* to
understanding that type of language.  Now, you may be getting at an example
where you need them iff you need to do all of this in the parser (i.e.,
without using any later stages).

Again, I can see how that approach *may* be easier and/or more efficient,
etc.  but I don't see any evidence that the actual power of the system has
increased at all.

Take care,
	John

 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/ 




More information about the antlr-interest mailing list