[antlr-interest] Semantical problem with Antlr

Alexey Demakov demakov at ispras.ru
Tue Jun 7 05:43:19 PDT 2005


Hello,

----- Original Message ----- 
From: "Serafettin Senturk" <serafettin_sentuerk at intergral.com>
To: <antlr-interest at antlr.org>
Sent: Tuesday, June 07, 2005 4:32 PM
Subject: [antlr-interest] Semantical problem with Antlr


>  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?

You need to write additional semantic checker that analyse AST
and set variable types.

And it is not always possible to choose type 
for variable if language allows to reuse variable for value of
different type. For example:

a = 3 + 5;
a = "a" + a;

It is not easy to choose a type for 'a' variable.

Regards,
Alexey

-----
Alexey Demakov
TreeDL: Tree Description Language: http://treedl.sourceforge.net
RedVerst Group: http://www.unitesk.com




More information about the antlr-interest mailing list