Hostname: page-component-8448b6f56d-jr42d Total loading time: 0 Render date: 2024-04-23T07:38:18.140Z Has data issue: false hasContentIssue false

Warnings for pattern matching

Published online by Cambridge University Press:  15 February 2007

LUC MARANGET*
Affiliation:
Inria Rocquencourt, BP 105, 78153 Le Chesnay Cedex, France (e-mail: Luc.Maranget@inria.fr)
Rights & Permissions [Opens in a new window]

Abstract

Core share and HTML view are not available for this content. However, as you have access to this content, a full PDF is available via the ‘Save PDF’ action button.

We examine the ML pattern-matching anomalies of useless clauses and non-exhaustive matches. We state the definition of these anomalies, building upon pattern matching semantics, and propose a simple algorithm to detect them. We have integrated the algorithm in the Objective Caml compiler, but we show that the same algorithm is also usable in a non-strict language such as Haskell. Or-patterns are considered for both strict and non-strict languages.

Type
Article
Copyright
Copyright © Cambridge University Press 2007

References

Aitken, W., (1992) SML/NJ Match Compiler Notes. http://www.smlnj.org/compiler-\url notes/matchcomp.ps.Google Scholar
Appel, A. W. and MacQueen, D. B., (1991) Standard ML of New Jersey. International Symposium on Programming Language Implementation and Logic Programming. Springer-Verlag. Lecture Notes in Computer Science 583.CrossRefGoogle Scholar
Augustsson, L., (1985) Compiling Pattern Matching. Functional Programming Languages and Computer Architecture. Springer-Verlag. Lecture Notes in Computer Science 201.Google Scholar
Baudinet, M. and MacQueen, D. B., (1985) Tree Pattern Matching for ML. http://www.smlnj.org/compiler-notes/85-note-baudinet.ps.Google Scholar
Garrigue, J., (2004) Typing Deep Pattern-Matching in Presence of Polymorphic Variants. JSSST Workshop on Programming and Programming Languages.Google Scholar
Harper, R. W., Milner, R. and Tofte, M., (1991) The Definition of Standard ML. The MIT Press.Google Scholar
Hudak, P., Peyton, Jones, S. L. et al. (1998) Haskell 98, A Non-Strict, Purely Functionnal Language. http://www.haskell.org/onlinereport/.Google Scholar
Huet, G. and Lévy, J.-J., (1991) Call by Need Computations in Non-Ambiguous Linear Term Rewriting Systems. Lassez, J.-L., & Plotkin, G. D, (eds), Computational Logic, Essays in Honor of Alan Robinson. MIT Press.Google Scholar
Kahn, G. and Plotkin, G. D., (1978) Domaines concrets. Tech. rept. 336. IRIA Laboria. (In French).Google Scholar
Laville, A., (1991) Comparison of Priority Rules in Pattern Matching and Term Rewriting. Journal of Symbolic Computations, 11 (4), 321348.CrossRefGoogle Scholar
Le Fessant, F. and Maranget, L., (2001) Optimizing Pattern Matching. International Conference on Functional Programming. ACM press.Google Scholar
Leroy, X., Doligez, D. et al. (2003) The Objective Caml Language (version 3.07). http://caml.inria.fr.Google Scholar
Maranget, L., (1992) Compiling Lazy Pattern Matching. Lisp and Functional Programming. ACM press.Google Scholar
Pettersson, M., (1992) A Term Pattern-Match Compiler Inspired by Finite Automata Theory. Workshop on Compiler Construction. Springer-Verlag. Lecture Notes in Computer Science 641.CrossRefGoogle Scholar
Peyton Jones, S. L., Hall, C. V., Hammond, K., Partain, W. and Wadler, P., (1993) The Glasgow Haskell Compiler: a Technical Overview. UK Joint Framework for Information Technology (JFIT) Technical Conference. http://www.haskell.org/ghc/.Google Scholar
Sekar, R. C., Ramesh, R. and Ramakrishnan, I. V., (1992) Adaptive Pattern Matching. International Colloquium on Automata Languages and Programming. Springer-Verlag. Lecture Notes in Computer Science 623.Google Scholar
Sestoft, P., (1996) ML Pattern Match Compilation and Partial Evaluation. Dagstuhl Seminar on Partial Evaluation. Springer-Verlag. Lecture Notes in Computer Science 1110.Google Scholar
Wadler, P., (1987) Efficient Compilation of Pattern Matching. In: Peyton, Jones, S. L., editor, The Implementation of Functional Programming Languages. Prentice-Hall.Google Scholar
Submit a response

Discussions

No Discussions have been published for this article.