On Wed, 2008-11-12 at 19:57 -0800, Vamsi Juvvi wrote:
> Hi list/the-not-so-idle-idle:
> 
>    While preparing a small antlr presentation for my colleagues I
> managed to generate code that VS 2005 simply refuses to compile.
> 
>    in my tree parser for a simple calculator example. I have
> 
> atom returns [double val]
>     : (
>             a=DECIMAL_LITERAL        
>         | a=HEX_LITERAL
>         | a=OCTAL_LITERAL
>        )
>        { val = parseInt($a.text);}
>        
>     | a=FLOATING_POINT_LITERAL 
>       {val = parseDouble($a.text);}
>     ;
> 
> The generated code for the atom method does this to initialize val
> 
> double val = 0.0D;
> 
> It does not compile unless I remove the D suffix on the 0.0. 0.0D is
> not a legal double literal for Visual studio C/C++. 

Works fine with VS2008. Perhaps your best bet is to compile with
the .Net C compiler.

> Is there any way I can turn this automatic initialization off ? Or is
> this a bug that'll need to be fixed in the C templates ? I can
> workaround this using a struct to wrap my double but that would be
> perverse.

It is auto-intialized in the templates. However, I suspect that I
probably changed it to use D for C++ or some other compiler. I will have
to retest it all to change that.

Jim

> 
> thanks much for reading.
> 
> -vamsi
> 
> -- 
> Between impulse and reaction lies man's greatest strength: The freedom
> to create a choice, to create his universe, to choose - Victor Frankl
> (adapted)
> List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
> Unsubscribe: 
> http://www.antlr.org:8080/mailman/options/antlr-interest/your-email-address
> 


List: http://www.antlr.org:8080/mailman/listinfo/antlr-interest
Unsubscribe: 
http://www.antlr.org:8080/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 [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/il-antlr-interest?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to