A Static Type Inference for Python
نویسندگان
چکیده
Dynamic languages, like Python, are attractive because they guarantee that no correct program is rejected prematurely. However, this comes at a price of losing early error detection, and making both code optimization and certification harder tasks when compared with static typed languages. Having the static certification of Python programs as a goal, we developed a static type inference system for a subset of Python, known as RPython. Some dynamic features are absent from RPython, nevertheless it is powerful enough as a Python dialect and exhibits most of its main features. Our type inference system tackles with almost all language constructions, such as object inheritance and subtyping, polymorphic and recursive functions, exceptions, generators, modules, etc., and is itself written in Python.
منابع مشابه
Type Systems of Scripting Languages
Type systems play an important role in the design of programming languages, they prevent programs from having non-correct behavior. Typically, type systems are expressed in two ways, type-checking and type inference. The type information presented on local variables and method arguments makes the difference in choosing one technique rather than the other. Type checking is a derivation type infe...
متن کاملUCPy: Reverse-Engineering Python
One of the recurring topics in the Python community is how to make Python programs run faster. Typically, a set of solutions is proposed which include: adding static type inference; somehow compiling programs into native code; translating Python programs into Parrot/Lisp/.net code; applying research results from dynamically-typed language implementation. Progress has been made on some of these,...
متن کاملTowards Type Inference for JavaScript
Object-oriented scripting languages like JavaScript and Python are popular partly because of their dynamic features. These include the runtime modification of objects and classes through addition of fields or updating of methods. These features make static typing difficult and so usually dynamic typing is used. Consequently, errors such as access to non-existent members are not detected until r...
متن کاملCombining Static and Dynamic Typing in Ruby
Title of dissertation: Combining Static and Dynamic Typing in Ruby Michael Furr Doctor of Philosophy, 2009 Dissertation directed by: Professor Jeffrey S. Foster Department of Computer Science Many popular scripting languages such as Ruby, Python, and Perl are dynamically typed. Dynamic typing provides many advantages such as terse, flexible code and the ability to use highly dynamic language co...
متن کاملPreemptive Type Checking in Dynamically Typed Languages
We describe a type system that identifies potential type errors in dynamically typed languages like Python. The system uses a flow-sensitive static analysis on bytecodes to compute, for every variable and program point, overapproximations of the variable’s present and future use types. If the future use types are not subsumed by the present types, the further program execution may raise a type ...
متن کامل