[antlr-interest] Off topic:Type handling

Monty Zukowski monty at codetransform.com
Mon Oct 18 14:05:03 PDT 2004


>
> Generally is not possible to determine the type of the variable.
> There is no why to be always capable of finding the type.
> In many cases however it is possible.
>
> I hope someone has faced a similar problem and can make some 
> suggestions on
> how to solve the problem.
>

I derived types for AREV BASIC by doing a simple data flow analysis.  I 
created a table of variables to their assignments.  Then I would 
recursively walk the assignments for a particular variable through any 
intermediate variables to see if I could tell that all of the original 
sources were strings or numbers.  Had to watch out for cycles.

In practice it worked pretty well, though AREV was annoying enough to 
turn strings into numbers for you automatically so I had to analyze the 
contents of strings as well.

I also took note of the operators used in assignments to a variable to 
deduce if it was a number or string.

Monty



 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/antlr-interest/

<*> To unsubscribe from this group, send an email to:
    antlr-interest-unsubscribe at yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 





More information about the antlr-interest mailing list