[antlr-interest] 3.1b1 throwing RewriteEmptyStreamExceptions
Jim Idle
jimi at temporal-wave.com
Sat Jul 5 18:00:01 PDT 2008
On Sat, 2008-07-05 at 16:07 -0700, Cameron Skinner wrote:
> I think it might have something to do with the fact that you have the plus operator on the INT token in the rewrite rule, but not in the parser rule itself?
>
> -----Original Message-----
> From: André van der Merwe <AndrevdM at pyrogenesis.co.za>
> Sent: Friday, July 04, 2008 5:38 AM
> To: antlr-interest at antlr.org <antlr-interest at antlr.org>
> Subject: [antlr-interest] 3.1b1 throwing RewriteEmptyStreamExceptions
>
>
> Hi,
>
> I can't get ANTLR 3.1b1 to generate ASTs using C#. Am I doing something wrong or is the beta not generating valid C# yet?
>
>
> Here is the very simplistic grammar I use. Parsing "1+1" will break with a RewriteEmptyStreamExceptions
>
> grammar Simple;
>
> options
> {
> output=AST;
> ASTLabelType=CommonTree;
> language=CSharp2;
> }
>
> expr : INT '+' INT -> ^('+' INT+);
This shoudl be:
expr: i+=INT '+' i+=INT -> ^('+' $i+);
Or:
expr : i1=INT '+' i2=INT -> ^('+' $i1 $i2) ;
Jim
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20080705/f7ea2e66/attachment.html
More information about the antlr-interest
mailing list