[antlr-interest] Semantical problem with Antlr

Martin Probst mail at martin-probst.com
Tue Jun 7 06:06:17 PDT 2005


If you're looking for an implementation hint, what about implementing a 
.getDataType() method in your AST nodes and by that inferring the type 
of your nodes? E.g. the type of "a" in your example is the type of the 
assignment content below "=", which is the type of the "+" operation 
which is in turn the type of the two arguments, somehow combined if not 
equal. I.e. you just have to call down within the tree.

Serafettin Senturk wrote:
>  Hello,
> 
>  I am trying to convert from typeless language to a typeful language like
> the following:
> 
>  from  (a = 3+5;)  to  ==>   (int a = 3+5;)
> 
>  I know we can get the result of such an expression. But is it possible with
> Antlr to evaluate the result semantically and according to the result put
> the appropriate data type for declaration? Does anybody have an idea about
> this semantical problem of Antlr?
> 
>  Best Regards,
>  Serafettin
> 
> 
> 
> 
> 



More information about the antlr-interest mailing list