{"title":"Towards a type-based abstract semantics for Python","authors":"Andrei Nacu","doi":"10.1016/j.jlamp.2024.101032","DOIUrl":null,"url":null,"abstract":"<div><div>Python is a high-level programming language that is strongly, but dynamically typed. In this paper, we propose a type inference framework to compute specifications for Python functions in isolation. To achieve this, we aim to use an abstract-interpretation-based data flow analysis to infer variable types on a subset of Python programs that use built-in types, operators and functions. To evaluate the expressions found in every program point, specifications for the encountered operations and functions are required. We propose a method for extracting these specifications from the Typeshed project, which contains a set of annotations for built-in and popular third-party libraries. These specifications will be used then to extend the proposed type inference to large Python programs.</div></div>","PeriodicalId":48797,"journal":{"name":"Journal of Logical and Algebraic Methods in Programming","volume":"143 ","pages":"Article 101032"},"PeriodicalIF":0.7000,"publicationDate":"2025-02-01","publicationTypes":"Journal Article","fieldsOfStudy":null,"isOpenAccess":false,"openAccessPdf":"","citationCount":"0","resultStr":null,"platform":"Semanticscholar","paperid":null,"PeriodicalName":"Journal of Logical and Algebraic Methods in Programming","FirstCategoryId":"94","ListUrlMain":"https://www.sciencedirect.com/science/article/pii/S2352220824000865","RegionNum":4,"RegionCategory":"数学","ArticlePicture":[],"TitleCN":null,"AbstractTextCN":null,"PMCID":null,"EPubDate":"","PubModel":"","JCR":"Q3","JCRName":"COMPUTER SCIENCE, THEORY & METHODS","Score":null,"Total":0}
引用次数: 0
Abstract
Python is a high-level programming language that is strongly, but dynamically typed. In this paper, we propose a type inference framework to compute specifications for Python functions in isolation. To achieve this, we aim to use an abstract-interpretation-based data flow analysis to infer variable types on a subset of Python programs that use built-in types, operators and functions. To evaluate the expressions found in every program point, specifications for the encountered operations and functions are required. We propose a method for extracting these specifications from the Typeshed project, which contains a set of annotations for built-in and popular third-party libraries. These specifications will be used then to extend the proposed type inference to large Python programs.
期刊介绍:
The Journal of Logical and Algebraic Methods in Programming is an international journal whose aim is to publish high quality, original research papers, survey and review articles, tutorial expositions, and historical studies in the areas of logical and algebraic methods and techniques for guaranteeing correctness and performability of programs and in general of computing systems. All aspects will be covered, especially theory and foundations, implementation issues, and applications involving novel ideas.