Two Techniques for Compiling Lazy Pattern Matching

Luc Maranget 1
1 PARA - Parallélisme
Inria Paris-Rocquencourt
Abstract : 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.
Type de document :
Rapport
[Research Report] RR-2385, INRIA. 1994
Liste complète des métadonnées

https://hal.inria.fr/inria-00074292
Contributeur : Rapport de Recherche Inria <>
Soumis le : mercredi 24 mai 2006 - 14:59:05
Dernière modification le : vendredi 25 mai 2018 - 12:02:05
Document(s) archivé(s) le : lundi 5 avril 2010 - 00:08:04

Fichiers

Identifiants

  • HAL Id : inria-00074292, version 1

Collections

Citation

Luc Maranget. Two Techniques for Compiling Lazy Pattern Matching. [Research Report] RR-2385, INRIA. 1994. 〈inria-00074292〉

Partager

Métriques

Consultations de la notice

171

Téléchargements de fichiers

123