A type system for data flow and alias analysis in ReScript
Nicky Ask Lund, Hans Hüttel
TL;DR
The paper develops a $\lambda$-calculus-based local data-flow analysis for a subset of ReScript, focusing on bindings and aliasing in a language with mutability and pattern matching. It introduces labelled expressions, a binding store model, and a dependency function to collect data-flow and alias information at program points, supported by a big-step collection semantics. Types are built from base types $(\delta,\kappa)$ and function types, together with an alias basis $\kappa^0$ and an approximated program-point order $\Pi$, enabling a sound abstraction of dependencies and aliasing. Soundness is established via environment/dependency agreements and supporting lemmas (History, Strengthening), showing that type judgments correctly approximate the operational semantics. The work outlines practical extensions, including a type checker, polymorphism, richer reference handling, type inference, and broader language constructs to enhance applicability.
Abstract
ReScript introduces a strongly typed language that targets JavaScript, as an alternative to gradually typed languages, such as TypeScript. In this paper, we present a type system for data-flow analysis for a subset of the ReScript language, more specific for a lambda-calculus with mutability and pattern matching. The type system is a local analysis that collects information about what variables are used and alias information.
