[antlr-interest] Expr example in Wiki compile error Eclipseusing ANTLRworks
Foolish Ewe
foolishewe at hotmail.com
Sat Dec 16 16:35:10 PST 2006
Hello All:
Thanks Ter, my initial thought was I had made some sort of error, but was
just too dense to see it.
Given the amount of improved functionality the ANTLR folks are introducing
in ANTLR3
and ANTLRworks, I am actually pleased with how robust the environment is and
how fast
fixes are applied in when something is discovered.
I have an additional question about the example grammar, the lexer and
perhaps Eclipse itself.
The example, Expr appears to hang when I run it in Eclipse, and I've added
debugging
output and actions to all non terminals (Please see attached source for
details).
In the trace for Expr in the wiki, it appears to read until it reaches EOF,
I've tried entering
^D (control D) into the Eclipse console window but that doesn't seem to
trigger the EOF
condition, nor do I see any of the expected output. Running it in the
debugger seems to indicate
that the ANTLRInputStream constructor does not terminate. Why is that?
My questions are:
1) Have I somehow screwed things up that the symptoms I'm seeing are my own
fault?
2) In Eclipse, is it possible to pass an EOF to System.in? (not an Antlr
question, but maybe I'll
get lucky).
3) If I want to limit buffering to one line of input at a time, is there
some other input class
I should be using in ANTLR.
Thanks:
Bill M.
>From: Terence Parr <parrt at cs.usfca.edu>
>To: ANTLR List <antlr-interest at antlr.org>
>Subject: Re: [antlr-interest] Expr example in Wiki compile error
>Eclipseusing ANTLRworks 1.0b8, ANTLR 3.0b5
>Date: Sat, 16 Dec 2006 11:08:44 -0800
>
>Hi Bill...sorry about that...try grabbing latest from depot browser, fixed
>after 3.0b5.
>
>I hope to do another release soon.
>
>Ter
>On Dec 16, 2006, at 10:52 AM, Foolish Ewe wrote:
>
>>I've tried getting some my stuff working ANTLR source code into eclipse,
>>by
>>adding the ANTLRworks 1.0b8 jar to my class path, and using ANTLRworks to
>>generate
>>the Java source and compile it in the Eclipse framework.
>>
>>The generated code had compiler errors, (as did my much larger example)
>>for the following
>>ANTLR source line:
>> | '(' expr ')' {$value = $expr.value;}
>>
>>The action $value=$expr.value; generates the following Java source (which
>>does not compile):
>>
>> value = $expr.value;
>>
>>Which does not compile.
>>
>>I've noticed in my own source that I've had to create attribute labels in
>>order
>>to get compilable code out of ANTLR1.0b5 (via ANTRLworks 1.0b8),
>>so changing the ANTLR source to read:
>>
>> | '(' myexpr=expr ')' {$value = $myexpr.value;}
>>
>>generates the following Java source (which does compile):
>>
>> value = myexpr;
>>
>>Does anyone have any idea why the published example in the wiki isn't
>>building
>>in this environment?
>>
>>Regards:
>>
>>Bill M.
>>
>>_________________________________________________________________
>>View Athlete’s Collections with Live Search http://
>>sportmaps.live.com/index.html?source=hmemailtaglinenov06&FORM=MGAC01
>>
>
_________________________________________________________________
Stay up-to-date with your friends through the Windows Live Spaces friends
list.
http://clk.atdmt.com/MSN/go/msnnkwsp0070000001msn/direct/01/?href=http://spaces.live.com/spacesapi.aspx?wx_action=create&wx_url=/friends.aspx&mk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Expr.g
Type: application/octet-stream
Size: 1116 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20061217/b9748dd9/attachment.obj
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Test.java
Type: application/octet-stream
Size: 905 bytes
Desc: not available
Url : http://www.antlr.org/pipermail/antlr-interest/attachments/20061217/b9748dd9/attachment-0001.obj
More information about the antlr-interest
mailing list