[antlr-interest] Re: some (maybe stupid) questions on aquiring expected tokens.

ioffe_nick ioffe_nick at yahoo.com
Wed Oct 20 12:03:21 PDT 2004



--- In antlr-interest at yahoogroups.com, "John D. Mitchell" <johnm-
antlr at n...> wrote:
> >>>>> "ioffe" == ioffe nick <ioffe_nick at y...> writes:
> [...]
> 
> > As I understand from the group antlr 3.0 is going to be table 
based
> 
> Nope, not a chance in hell of that happening.  :-)
Ok.

> 
> > and thus will provide some way to calculate the expect set.
> 
> That sort of information will definitely be made available.  After
> predicate hoisting, "error handling" has been my biggest carping.
> 
> Check out the summary notes from the recent Antlr workshop:
> http://www.antlr.org/workshop/ANTLR2004/summary.tml
> 
> Take care,
> 	John

Well, after going through the summary I haven't found any mentioning
of expected set (or maybe I don't know the correct name:-()

The only thing I've seen was better information in error handling,
but I need the expected set not for error handling but for providing
the user the list of valid possibilities.

In current ANTLR version I've found the way of doing it manually - 
using stack of $FIRSTs and using epsilon-impossible attribute for each
rule. But all of this works only for lookahead of 1.
In case of lookahead of n $FIRST should contain token n-tuples.
And it is semi-automatic and error-prone, since I have no way to know
in runtime whether the non-terminal may finish as epsilon-production.


That's why I think tables are good for this purpose.

I agree that for general parsing tables are horrible since you may
spend days to discover the context causing the problem.

Anyway, thank you for discussion

Nick






 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

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





More information about the antlr-interest mailing list