Table of Contents
Fetching ...

Towards Cumulative Abstract Semantics via Handlers

Cade Lueker, Andrew Fox, Bor-Yuh Evan Chang

TL;DR

The paper addresses the rigidity of traditional abstract interpretation frameworks by proposing cumulative abstract semantics implemented with scoped effect handlers. It separates syntax elimination from domain introduction, enabling multiple semantic interpretations from a single interpreter. Introduction and elimination handlers define how domains are introduced and how control-flow is manipulated, demonstrated with an interval domain. This modular approach aims to simplify extending analyses and supporting both single-path and multi-path control flow, paving the way for a flexible framework for modular static analyses.

Abstract

We consider the problem of modularizing control flow in a generic abstract interpretation framework. A generic abstract interpretation framework is not truly flexible if it does not allow interpreting with different path- and flow-sensitivities, by going forwards or backwards, and over- or under-approximately. Most interpreters inherently intertwine syntax and semantics, making the implementation antagonistic to modularity. Current approaches to modular designs require the use of complex data structures (e.g., monad transformers), providing modularity but often proving unwieldy (e.g., lifts). We observe that leveraging scoped effects within an interpreter facilitates the accumulation of semantic fragments against a fixed syntax. In this paper, we define cumulative abstract semantics, illustrating the potential for creating multiple dynamic evaluators and static analyses from one interpreter. This modularity is achieved by grouping effects into two categories: syntax elimination and domain-semantic introduction handlers. Our contribution shows the benefits of using effects as an instrument for designing a clean, elegant, and modular abstract interpretation framework.

Towards Cumulative Abstract Semantics via Handlers

TL;DR

The paper addresses the rigidity of traditional abstract interpretation frameworks by proposing cumulative abstract semantics implemented with scoped effect handlers. It separates syntax elimination from domain introduction, enabling multiple semantic interpretations from a single interpreter. Introduction and elimination handlers define how domains are introduced and how control-flow is manipulated, demonstrated with an interval domain. This modular approach aims to simplify extending analyses and supporting both single-path and multi-path control flow, paving the way for a flexible framework for modular static analyses.

Abstract

We consider the problem of modularizing control flow in a generic abstract interpretation framework. A generic abstract interpretation framework is not truly flexible if it does not allow interpreting with different path- and flow-sensitivities, by going forwards or backwards, and over- or under-approximately. Most interpreters inherently intertwine syntax and semantics, making the implementation antagonistic to modularity. Current approaches to modular designs require the use of complex data structures (e.g., monad transformers), providing modularity but often proving unwieldy (e.g., lifts). We observe that leveraging scoped effects within an interpreter facilitates the accumulation of semantic fragments against a fixed syntax. In this paper, we define cumulative abstract semantics, illustrating the potential for creating multiple dynamic evaluators and static analyses from one interpreter. This modularity is achieved by grouping effects into two categories: syntax elimination and domain-semantic introduction handlers. Our contribution shows the benefits of using effects as an instrument for designing a clean, elegant, and modular abstract interpretation framework.

Paper Structure

This paper contains 8 sections, 8 equations, 5 figures.

Figures (5)

  • Figure 1: A standard, big-step, concrete substantiated interpreter ${\color{Asparagus}\Downarrow}_0$.
  • Figure 2: An abstract unsubstantiated interpreter ${\color{Fern}\breve{\Downarrow}}_1$, a concrete substantiated interpreter ${\color{Asparagus}\Downarrow}_2$, and an abstract substantiated interpreter with the interval domain ${\color{Asparagus}\Downarrow}_3$.
  • Figure 3: Extending the standard, big-step, concrete substantiated interpreter ${\color{Asparagus}\Downarrow}_0$ with conditionals.
  • Figure 4: An abstract interpreter ${\color{Fern}\breve{\Downarrow}}_4$ unsubstantiated by the introduction handler ${\color{Maroon}\grave{n}}$ and elimination handlers ${\color{Teal}\acute{+}}, {\color{Teal}\acute{\mathrm{ifnz}}}$ and a concrete substantiated interpreter ${\color{Asparagus}\Downarrow}_5$.
  • Figure 5: An abstract interpreter ${\color{Fern}\breve{\Downarrow}}_6$ defined in terms of ${\color{Fern}\breve{\Downarrow}}_4$ from \ref{['fig:eval-v2']}, which is now unsubstantiated only by the introduction handlers ${\color{Maroon}\grave{n}}, {\color{Maroon}\grave{+}}$