A Typed Intermediate Representation for Dynamic Languages
Dynamic programming languages pose significant challenges for optimizing compilers due to features such as dynamic typing, late binding, reflection, copy-on-write, and delayed evaluation. To generate efficient code, compilers must speculate on which dynamic features will be exercised and produce specialized code based on these assumptions. This paper presents the design of a statically typed, high-level intermediate representation that makes dynamic behaviors explicit and amenable to static analysis. Our IR combines gradual typing with ownership tracking, and explicitly represents promises, multiple function versions, and contextual dispatch. Together, these features directly support optimizations such as specialization, inlining, scope elision, and copy elimination. We formalize a core calculus, called FIŘ, that captures the essential features required for these optimizations. We provide an operational semantics, a type system, and flow and reflection analyses, and we prove the soundness of the type system.
Authors
- Mickaël Laurent (ORCID: https://orcid.org/0000-0003-1590-2392)
- Filip Křikava (ORCID: https://orcid.org/0000-0002-0478-6202)
- Sebastián Krynski (ORCID: https://orcid.org/0000-0002-4124-0225)
- Jan Vítek (ORCID: https://orcid.org/0000-0003-4052-3458)
- Jakob Hain
Institutions
- Charles University (CZ)
- Purdue University West Lafayette (US)
- Czech Technical University in Prague (CZ)
Publication Details
- Journal
- ACM Transactions on Programming Languages and Systems
- Published
- 2026-04-25
- DOI
- https://doi.org/10.1145/3811921
- Primary Topic
- Logic, programming, and type systems
- Type
- article
- Field-Weighted Citation Impact
- 0.00