[antlr-interest] distinguishing between int and double in a tree grammar
anders.hessellund at gmail.com
Mon Mar 16 03:53:38 PDT 2009
I understand in principle what you mean but I am unsure on how to implement
it using ANTLR.
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
> > and double division return very different results. I guess someone must
> > have looked at this when doing type conversions/coercions. Here is my
> > grammar:
> you give the type to the constants and variables and when going over the
> 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...
> List: http://www.antlr.org/mailman/listinfo/antlr-interest
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the antlr-interest