[antlr-interest] distinguishing between int and double in a tree grammar

Anders Hessellund anders.hessellund at gmail.com
Mon Mar 16 03:53:38 PDT 2009


Thanks,

I understand in principle what you mean but I am unsure on how to implement
it using ANTLR.

-- Anders

2009/3/16 Michael <micha-1 at fantasymail.de>

> Am Monday 16 March 2009 11:12:02 schrieb Anders Hessellund:
> > Hi,
> >
> > It is important to distinguish between these types because integer
> division
> > and double division return very different results. I guess someone must
> > have looked at this when doing type conversions/coercions. Here is my
> tree
> > grammar:
>
> you give the type to the constants and variables and when going over the
> tree
> the operators decide on their argument types what to coerce
>
> so 3 is an int and 5.4 is a double, now "/" has an int and a double as
> arguments so it can insert a coercion from int to double for it's first
> parameter (or force you to write a coercion)...
>
> if "/" gets a boolean and a char it can throw a type error...
>
>
>  Michael
>
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
> Unsubscribe:
> http://www.antlr.org/mailman/options/antlr-interest/your-email-address
>



-- 
Anders Hessellund
www.itu.dk/people/hessellund/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.antlr.org/pipermail/antlr-interest/attachments/20090316/49c6b6bc/attachment.html 


More information about the antlr-interest mailing list