[antlr-interest] Unexpected token error

Terence Parr parrt at cs.usfca.edu
Mon Mar 8 11:31:58 PST 2004


You need (attr)+ not attr+ :)

Ter

On Mar 8, 2004, at 11:19 AM, Jerry Dy wrote:

> Hi, I get an unexpected error for simple grammar below. Can someone
> explain to me why? Thanks!
>
> -Jerry
>
> options { language="Cpp"; }
> class PageParser extends Parser;
> options { buildAST = true; }
> page: element
>         ;
> element: attr+
>         ;
> attr: ID
>         ;
>
> class PageLexer extends Lexer;
> ID: 'a'
>         ;
>
> ANTLR Parser Generator   Version 2.7.3 (20040224-91)   1989-2003
> jGuru.com
> soac.g:6:10: rule classDef trapped:
> soac.g:6:10: unexpected token: attr
> error: aborting grammar 'PageParser' due to errors
> Exiting due to errors.
> *** Error code 1
> clearmake: Error: Build script failed for "PageLexer.cpp"
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
--
Professor Comp. Sci., University of San Francisco
Creator, ANTLR Parser Generator, http://www.antlr.org
Cofounder, http://www.jguru.com
Cofounder, http://www.knowspam.net enjoy email again!
Cofounder, http://www.peerscope.com pure link sharing





 
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