[antlr-interest] help antlr.jar

Fernando Freitas nandows at gmail.com
Mon Nov 9 10:33:03 PST 2009


Thanks Jim.

really it's not an infinite loop.

sorry!


Regards

Fernando

2009/11/9 Jim Idle <jimi at temporal-wave.com>

>  It’s not an infinite loop, it is waiting for you to type something in and
> press CTRL-D or CTLR-Z. The input stream is System.in.
>
>
>
> Jim
>
>
>
> *From:* antlr-interest-bounces at antlr.org [mailto:
> antlr-interest-bounces at antlr.org] *On Behalf Of *Fernando Freitas
> *Sent:* Monday, November 09, 2009 9:45 AM
> *To:* antlr-interest at antlr.org
> *Subject:* [antlr-interest] help antlr.jar
>
>
>
> Hello people,
>        this is my first time with antlr and I am trying to use this tool.
>
> My firt step was the example of the book "The definitive antlr reference".
>
> Folows below the grammar of pag 29.
>
> T.g
>
> grammar T;
> /** Match things like "call foo;" */
> r : 'call' ID ';' {System.out.println("invoke "+$ID.text);} ;
> ID: 'a'..'z' + ;
> WS: (' ' |'\n' |'\r' )+ {$channel=HIDDEN;} ; // ignore whitespace
>
>
> The antlr generate this files:
>
>  TLexer.java  T__.g   T.tokens   TParser.java
>
> Very good!
>
> The next page , shows the Test.java for test it.
>
>
> folows below
>
>
> public class Test {
> public static void main(String[] args) throws Exception {
>
> // create a CharStream that reads from standard input
> ANTLRInputStream input = new ANTLRInputStream(System.in);
>
> // create a lexer that feeds off of input CharStream
> TLexer lexer = new TLexer(input);
>
> // create a buffer of tokens pulled from the lexer
> CommonTokenStream tokens = new CommonTokenStream(lexer);
>
> // create a parser that feeds off the tokens buffer
> TParser parser = new TParser(tokens);
>
> // begin parsing at rule r
> parser.r();
> }
> }
>
>
>
> I try to run this Test with some versions : 3.2 ... 3.1
>
> and in this line:
>
> ANTLRInputStream input = new ANTLRInputStream(System.in);
>
> always occurs a infinite looping.
>
>
> 1)  Can someone help me with this problem?
>
>
> Best Regards
> Fernando Freitas
>
>
>
>
>
>
>
>
>
>
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20091109/e3400fbd/attachment.html 


More information about the antlr-interest mailing list