Two Techniques for Compiling Lazy Pattern Matching - Inria - Institut national de recherche en sciences et technologies du numérique Accéder directement au contenu
Rapport (Rapport De Recherche) Année : 1994

Two Techniques for Compiling Lazy Pattern Matching

Luc Maranget

Résumé

In ML~style pattern matching, pattern size is not constrained and ambiguous patterns are allowed. This generality leads to a clear and concise programming style but is challenging in the context of lazy evaluation. A first challenge concerns language designers: in lazy ML, the evaluation order of expressions follows actual data dependencies. That is, only the computations that are needed to produce the final result are performed. Once given a proper (that is, non-ambiguous) semantics, pattern matching should be compiled in a similar spirit: any value matching a given pattern should be recognized by performing only the minimal number of elementary tests needed to do so. This challenge was first met by A.~Laville. A second challenge concerns compiler designers. As it stands, Lavillés compilation algorithm cannot be incorporated in an actual lazy ML compiler for efficiency and completeness reasons. As a matter of fact, Lavillés original algorithm did not fully treat the case of integers in patterns and can lead to explosions both in compilation time and generated code size. This paper provides a complete solution to that second challenge. In particular, the well-known (and size-efficient) pattern matching compilation technique using backtracking automata is here introduced for the first time into the world of lazy pattern matching.

Domaines

Autre [cs.OH]
Fichier principal
Vignette du fichier
RR-2385.pdf (397.15 Ko) Télécharger le fichier

Dates et versions

inria-00074292 , version 1 (24-05-2006)

Identifiants

  • HAL Id : inria-00074292 , version 1

Citer

Luc Maranget. Two Techniques for Compiling Lazy Pattern Matching. [Research Report] RR-2385, INRIA. 1994. ⟨inria-00074292⟩
463 Consultations
266 Téléchargements

Partager

Gmail Facebook X LinkedIn More