[antlr-interest] Re: Local lookahead depth
Tom Moog
tmoog at polhode.com
Mon Nov 10 06:11:39 PST 2003
I remember that John Lilley required the use of actions inside
guess blocks to parse C++. I believe that parsing some C++
declarations which make use of nested classes might require
symbol table additions that must be undone if the guess fails.
Reasonable people may disagree about whether C++ is a real
programming language or not (laugh). He created a special
version of pccts for this purpose.
In pccts, one can execute actions in guess mode by exploiting
the way in which code is generated. Since init-actions are
executed even in guess mode, one can put semantic actions
there - even though they are only to supposed to have
declarations.
The important thing to remember is that init-actions may be
executed multiple times as back-tracking takes place. Even if
the first guess is correct, the init-action will be executed
twice: once in guess mode and once in non-guess mode after
the guess succeeds. In the case where there is a guess
within a guess, its quite possible that an init-action
would be executed 4 times, etc.
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list