[antlr-interest] newbie problems
Anders Hessellund
anders.hessellund at gmail.com
Sat Jun 23 08:04:25 PDT 2007
Thanks,
that did the trick (although I am not entirely sure how).
-- Anders
2007/6/23, Gevik Babakhani <gevik at xs4all.nl>:
>
> Hi,
>
>
>
> Here is a fix for your grammar. These things are well explained in the
> ANTLR book.
>
>
>
> grammar Test;
>
>
>
> site : page+
>
> ;
>
>
>
> page : 'PAGE' ID
>
> ;
>
>
>
> ID : LETTER+
>
> ;
>
>
>
> TEXT : LETTER ( LETTER )*
>
> ;
>
>
>
> LETTER : 'a'..'z'|'A'..'Z'
>
> ;
>
>
>
>
>
> WS : (' ' | '\t' | '\r' | '\n')+ {$channel=HIDDEN;}
>
> ;
>
>
>
>
> ------------------------------
>
> *From:* antlr-interest-bounces at antlr.org [mailto:
> antlr-interest-bounces at antlr.org] *On Behalf Of *Anders Hessellund
> *Sent:* Saturday, June 23, 2007 12:50 PM
> *To:* antlr
> *Subject:* [antlr-interest] newbie problems
>
>
>
> Hi,
>
> I am sorry about the newbie question but neither google nor this list
> seems to have any obvious answers to my question :)
>
> I have just started with antlr by defining this little grammar:
>
> grammar Web;
>
> site : page+
> ;
>
> page : 'PAGE' ID
> ;
>
> ID : LETTER+
> ;
>
> TEXT : LETTER ( LETTER | WS )*
> ;
>
> LETTER : 'a'..'z'|'A'..'Z'
> ;
>
> NEWLINE : '\r'? '\n'
> ;
>
> WS : (' ' | '\t' | '\n' | '\r' )+ { skip(); }
> ;
>
>
> Then I generate my lexer and parser tools and feed them the follow input
> file
>
>
>
> PAGE helloWorld
>
>
> I get the following strange error. Could someone please explain why??
>
> line 0:-1 required (...)+ loop did not match anything at input '<EOF>'
>
>
>
> -- Anders
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20070623/146a6e00/attachment-0001.html
More information about the antlr-interest
mailing list