[il-antlr-interest: 27343] [antlr-interest] Problems with first example

2009-12-21 Thread Bill Ramsay
Hello,

I'm new to Antlr and am trying to work through the Definitive Guide.   I can't 
seem to get the first example to work.
I create the .g file and lexer and parser classes fine.   I compile my example 
test program fine.   And it runs fine.  Except for one minor problem - it 
doesn't work.   I put a few debug lines in the code and  it gets hung up on the 
line:

ANTLRInputStream input = new ANTLRInputStream(System.in);

It never seems to move past this line.   The code used is copied from the 
book,page 10 - 12.

Bill

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--

You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.




[il-antlr-interest: 27344] Re: [antlr-interest] Problems with first example

2009-12-21 Thread John B. Brodie
Greetings!
On Mon, 2009-12-21 at 09:08 -0500, Bill Ramsay wrote:
 Hello,
 
 I'm new to Antlr and am trying to work through the Definitive Guide.   I 
 can't seem to get the first example to work.
 I create the .g file and lexer and parser classes fine.   I compile my 
 example test program fine.   And it runs fine.  Except for one minor problem 
 - it doesn't work.   I put a few debug lines in the code and  it gets hung up 
 on the line:
 
 ANTLRInputStream input = new ANTLRInputStream(System.in);
 
 It never seems to move past this line.   The code used is copied from the 
 book,page 10 - 12.

System.in is java-speak for the standard input device which, unless you
have redirected it, is your keyboard.

So this line is establishing a I/O connection with the keyboard in order
to read in text to be parsed.

It would seem that everything is working just fine.

You simply need to type some text into your keyboard so that the example
grammar may parse it for you (or re-direct stdin to a disk file).

Hope this helps...
   -jbb



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--

You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.




[il-antlr-interest: 27345] Re: [antlr-interest] Are embedded actions are allowed in StringTemplate? (+)

2009-12-21 Thread Terence Parr
They are retargetable for specifically that reason.  Sounds like you  
should check out my papers on separability and my talks on  
retargetability.  Note that ANTLR has one code generator and multiple  
template groups to handle the multiple targets. proof one might say.

Ter
On Dec 20, 2009, at 11:17 PM, Дмитрий Волосных wrote:

 Yes, but in this case the translation logic intended by the target- 
 language won't be enclosed in a stg-file, what contradicts with  
 claimed idea of retargetable code generators.

 21 декабря 2009 г. 4:41 пользователь Terence Parr  
 pa...@cs.usfca.edu написал:
 if(v)...endif but v must be computed in model and pushed into  
 templates.
 Ter

 On Dec 20, 2009b, at 1:41 PM, Дмитрий Волосных wrote:

 Especially, I am intereseted in altering genereted text depending on  
 the value of some parameter of the template.

 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: 
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address



--

You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.



List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address


[il-antlr-interest: 27346] Re: [antlr-interest] Problems with first example

2009-12-21 Thread Terence Parr
and don't forget hitting ctrl-z for EOF if you're a PC person or ctrl- 
d if you're a unix guy, as gawd intended ;)
Ter
On Dec 21, 2009, at 6:30 AM, John B. Brodie wrote:

 Greetings!
 On Mon, 2009-12-21 at 09:08 -0500, Bill Ramsay wrote:
 Hello,

 I'm new to Antlr and am trying to work through the Definitive  
 Guide.   I can't seem to get the first example to work.
 I create the .g file and lexer and parser classes fine.   I compile  
 my example test program fine.   And it runs fine.  Except for one  
 minor problem - it doesn't work.   I put a few debug lines in the  
 code and  it gets hung up on the line:

ANTLRInputStream input = new ANTLRInputStream(System.in);

 It never seems to move past this line.   The code used is copied  
 from the book,page 10 - 12.

 System.in is java-speak for the standard input device which, unless  
 you
 have redirected it, is your keyboard.

 So this line is establishing a I/O connection with the keyboard in  
 order
 to read in text to be parsed.

 It would seem that everything is working just fine.

 You simply need to type some text into your keyboard so that the  
 example
 grammar may parse it for you (or re-direct stdin to a disk file).

 Hope this helps...
   -jbb



 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe: 
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address


List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--

You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.




[il-antlr-interest: 27349] Re: [antlr-interest] illegal option output and ! operator

2009-12-21 Thread testn

It used to work in ANTLR 2, though



Gavin Lambert wrote:
 
 At 03:45 19/12/2009, Rick Schumeyer wrote:
The following rule generates an illegal option output error 
when I attempt to generate code in antrlworks 1.3.1.

EQUOTE:'\\'! '';

I see that others have had the same problem, but I couldn't find 
the solution.

Is the ! operator supposed to work in a non-AST grammar?
 
 No, and not in the lexer.  Instead of using !, you need to 
 explicitly set the text of the token via { $text = xxx; } or { 
 setText(xxx); } or something similar, depending on your target 
 language.  See the examples and the wiki.
 
 
 List: http://www.antlr.org/mailman/listinfo/antlr-interest
 Unsubscribe:
 http://www.antlr.org/mailman/options/antlr-interest/your-email-address
 
 

-- 
View this message in context: 
http://n2.nabble.com/illegal-option-output-and-operator-tp4186924p4201949.html
Sent from the ANTLR mailing list archive at Nabble.com.

List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org/mailman/options/antlr-interest/your-email-address

--

You received this message because you are subscribed to the Google Groups 
il-antlr-interest group.
To post to this group, send email to il-antlr-inter...@googlegroups.com.
To unsubscribe from this group, send email to 
il-antlr-interest+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en.