Event description
R is a dynamically typed, vector-oriented language widely used for data analysis. Its vector semantics, including automatic type coercion, recycling, and flexible selection, are pervasive, non-trivial, and deeply intertwined with the semantics of virtually every R operation. The complexity and counter-intuitive nature of this semantics make static reasoning about R programs particularly challenging, and existing tools offer only shallow analyses that fall short of reasoning about R vector manipulating programs. In this talk, we present a parametric abstract domain for R vectors, defined over 𝜇𝑅, a core calculus we design to capture the important vector operations in R. An abstract vector simultaneously captures the possible lengths of the vector, the values of its elements, and its potential attributes. The domain is parametric in the element abstract domain. We define abstract operators for all 𝜇𝑅 operations and equip the domain with a widening operator to ensure termination. We implement the domain on top of flowR, a static analysis framework for R, and evaluate it on a suite of 61 handcrafted programs covering six categories of vector operations, demonstrating the feasibility and precision of the approach.