Knit&Frog: Pattern matching compilation for custom memory representations (doctoral session) - Inria - Institut national de recherche en sciences et technologies du numérique Access content directly
Conference Papers Year :

Knit&Frog: Pattern matching compilation for custom memory representations (doctoral session)


Initially present only in functional languages such as OCaml and Haskell, Algebraic Data Types have now become pervasive in mainstream languages, providing nice data abstractions and an elegant way to express functions though pattern-matching. Numerous approaches have been designed to compile rich pattern matching to cleverly designed, efficient decision trees. However, these approaches are specific to a choice of internal memory representation which must accommodate garbage-collection and polymorphism. ADTs now appear in languages more liberal in their memory representation such as Rust. Notably, Rust is now introducing more and more optimizations of the memory layout of Algebraic Data Types. As memory representation and compilation are interdependent, it raises the question of pattern matching compilation in the presence of non-regular, potentially customized, memory layouts. In this article, we present Knit&Frog, a framework to compile pattern-matching for monomorphic ADTs, parametrized by an arbitrary memory representation. We propose a novel way to describe choices of memory representation along with a validity condition under which we prove the correctness of our compilation scheme. The approach is implemented in a prototype tool ribbit.
Fichier principal
Vignette du fichier
afadl_2022_baudon_hal.pdf (150.63 Ko) Télécharger le fichier
Origin : Files produced by the author(s)

Dates and versions

hal-03676356 , version 1 (23-05-2022)


  • HAL Id : hal-03676356 , version 1


Thaïs Baudon, Gabriel Radanne, Laure Gonnord. Knit&Frog: Pattern matching compilation for custom memory representations (doctoral session). AFADL 2022 - 21ème journées Approches Formelles dans l'Assistance au Développement de Logiciels, Jun 2022, Vannes, France. ⟨hal-03676356⟩
53 View
24 Download


Gmail Facebook Twitter LinkedIn More