[antlr-interest] Epsilon productions and end of file

Arnar Birgisson arnarb at oddi.is
Wed Dec 17 03:13:19 PST 2003


Hello

> > This means that you must specifically tell ANTLR where to expect
> > end-of-file, and for that you use the special token EOF.
> 
> Yes, but when I use explicit EOF, it does not calculate 
> follow sets as I
> would expect. For example
> 
> S -> AB , means taht follow set of S goes to follow set of B (with $)
> 
> S -> AB EOF ends with EOF in follow set of S, nothing to do with B

I'm sorry, I don't quite follow. S -> AB EOF should not result in EOF
being in FOLLOW(S), but in FOLLOW(B).

I'm not even sure how ANTLR parsers, being recursive-descent parsers,
use the follow set. Anyone?

> >
> > As for epsilon-productions, you would use the ? operator. In you
> > example,
> >
> > production: ( other_production )? ;
> 
> Isn't taht valid only for regular languages ? Does that hold with
> context-free ones ?

ANTLR uses regular-like syntax to express certain constructs in LL(k)
languages (which are context-free). Please see the ANTLR manual at
www.antlr.org for reference.

> --
> Greetings
> Marcin Rzeznicki
> 
> 
> 
> 
>  
> 
> 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/ 
> 
> 
> 


 

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