[antlr-interest] Re: woohoo! ParseTrees for free, Debugging for me!
Terence Parr
parrt at cs.usfca.edu
Sun Nov 30 11:16:05 PST 2003
On Sunday, November 30, 2003, at 10:24 AM, Ruslan Zasukhin wrote:
> on 11/30/03 8:07 PM, Terence Parr at parrt at cs.usfca.edu wrote:
>
>>> I wonder, if this way can help with auto-completion task ?
>>
>> Interesting idea, though I suspect that since derivations are specific
>> to an input stream using $FIRST and $FOLLOW are more useful.
>
> :-)
>
> It will be great to have at least ANY simply example,
> How to use ANTLR on this task.
Well, there is nothing automatic I'm afraid. What one needs is a way
to trace precisely where in a grammar the parse is at any moment. Then
one can ask "what can come next". This could be auto-generated pretty
easily I'd say by having ANTLR build a Map from grammar position to
"next symbols" for every token reference in the grammar. Then, in
match() or whatever you'd set a variable called position. Then you can
query the Map to figure out what is next.
In the new ANTLR 3 stuff, you could keep around a copy of the grammar
lookahead automaton so that you could just ask directly "what can come
next". Doesn't help you now, but in the future this kind of thing
should be easy.
Ter
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Co-founder, http://www.jguru.com
Co-founder, http://www.knowspam.net enjoy email again!
Co-founder, http://www.peerscope.com link sharing, pure-n-simple
Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
More information about the antlr-interest
mailing list