Type inference of PyPy

Hi, I'm a Masters student in CS at University of Porto and the purpose of my thesis is the development of a Why module for Python. Why is a software verification platform (VCG). There is already such tools for C (frama-c) and Java (krakatoa). To that end, I need to infer the type of program variables. I'd like to use type inference of PyPy (for RPython). I know there is a statement (x.knowntype) that given the type of the arguments it gives the type of return variable, but I want to know if it is also possible to access the type of local variables. Thanks, Eva.

Hi, On Tue, Feb 02, 2010 at 02:06:45PM +0000, eva_maia@sapo.pt wrote:
To that end, I need to infer the type of program variables. I'd like to use type inference of PyPy (for RPython).
Two warnings before you go any further (I guess you already know about it but it doesn't hurt repeating it): 1. You can't infer the type of most program variables in Python: http://codespeak.net/pypy/dist/pypy/doc/faq.html#can-pypy-compile-normal-pyt... 2. PyPy's type inference only works for RPython, not for Python programs.
I know there is a statement (x.knowntype) that given the type of the arguments it gives the type of return variable, but I want to know if it is also possible to access the type of local variables.
In the RPythonAnnotator instance there is a dictionary called 'bindings' that maps local variables to the corresponding SomeXxx instances. What you don't get "out of the box" is the mapping from the real local variables in your Python source code -- only from Variable instances, which are produced by the flow object space. A bientot, Armin.
participants (2)
-
Armin Rigo
-
eva_maia@sapo.pt