Abstract
We present a simple, practical algorithm for higher order matching in the context of automatic program transformation. Our algorithm finds more matches than the standard second order matching algorithm of Huet and Lang, but it has an equally simple specification, and it is better suited to the transformation of programs in modern programming languages such as Haskell or ML. The algorithm has been implemented as part of the MAG system for transforming functional programs.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Alt, M., Fecht, C., Ferdinand, C., Wilhelm, R.: The TrafoLa-H subsystem. In: Hoffmann, B., Krieg-Brückner, B. (eds.) Program Development by Specification and Transformation The PROSPECTRA Methodology, Language Family, and System. LNCS, vol. 680, pp. 539–576. Springer, Heidelberg (1993)
Biggerstaff, T.: Pattern matching for program generation: A user manual. Technical Report MSR TR-98-55, Microsoft Research (1998), Available from http://www.research.microsoft.com/~tedb/Publications.htm
Bird, R.S.: The promotion and accumulation strategies in functional programming. ACM Transactions on Programming Languages and Systems 6(4), 487–504 (1984)
Bird, R.S.: Introduction to Functional Programming in Haskell. International Series in Computer Science. Prentice Hall, Englewood Cliffs (1998)
Boulton, R.J.: A restricted form of higher-order rewriting applied to an HDL semantics. In: Hsiang, J. (ed.) RTA 1995. LNCS, vol. 914, pp. 309–323. Springer, Heidelberg (1995)
Cai, J., Paige, R., Tarjan, R.E.: More efficient bottom-up multi-pattern matching in trees. Theoretical Computer Science 106(1), 21–60 (1992)
Comon, H.: Higher-order matching and tree automata. In: Nielsen, M. (ed.) CSL 1997. LNCS, vol. 1414, pp. 157–176. Springer, Heidelberg (1998)
Crew, R.F.: A language for examining abstract syntax trees. In: Ramming, C. (ed.) Proc. of the Conf. on Domain-Specific Languages. Usenix (1997)
de Moor, O., Sittampalam, G.: Generic program transformation. In: Third International Summer School on Advanced Functional Programming. LNCS. Springer, Heidelberg (1998)
de Moor, O., Sittampalam, G.: Higher-order matching for program transformation (full report) (March 1999), Available from http://www.comlab.ox.ac.uk/oucl/users/oege.demoor/pubs.htm
Dougherty, D.J.: Higher-order unification via combinators. Theoretical Computer Science 114, 273–298 (1993)
Dowek, G.: A second-order pattern matching algorithm for the cube of typed lambda calculi. In: Tarlecki, A. (ed.) MFCS 1991. LNCS, vol. 520, pp. 151–160. Springer, Heidelberg (1991)
Dowek, G.: Third order matching is decidable. In: Nielsen, M., Thomas, W. (eds.) Logic in Computer Science (LICS). IEEE, Los Alamitos (1992)
Huet, G., Lang, B.: Proving and applying program transformations expressed with second-order patterns. Acta Informatica 11, 31–55 (1978)
Krieg-Brückner, B., Liu, J., Shi, H., Wolff, B.: Towards correct, efficient and reusable transformational developments. In: Jähnichen, S., Broy, M. (eds.) KORSO 1995. LNCS, vol. 1009, pp. 270–284. Springer, Heidelberg (1995)
Miller, D.: A logic programming language with lambda-abstraction, function variables, and simple unification. Journal of Logic and Computation 1, 479–536 (1991)
Nipkow, T.: Higher-order unification, polymorphism, and subsorts. In: Okada, M., Kaplan, S. (eds.) CTRS 1990. LNCS, vol. 516, pp. 436–447. Springer, Heidelberg (1991)
Nipkow, T.: Functional unification of higher-order patterns. In: 8th IEEE Symposium on Logic in Computer Science, pp. 64–74. IEEE Computer Society Press, Los Alamitos (1993)
Paige, R.: Viewing a program transformation system at work. In: Penjam, J. (ed.) PLILP 1994. LNCS, vol. 844, pp. 5–24. Springer, Heidelberg (1994)
Peyton-Jones, S.L., Santos, A.L.M.: A transformation-based optimiser for Haskell. Science of Computer Programming 32(1-3), 3–48 (1998)
Pfenning, F., Elliott, C.: Higher-order abstract syntax. In: Proc. SIGPLAN 1988 Conf. on Programming Language Design and Implementation, pp. 199–208. ACM, New York (1988)
Simonyi, C.: Intentional programming: Innovation in the legacy age. Presented at IFIP Working group 2.1(1996), Available from http://www.research.microsoft.com/research/ip/
Smith, D.R.: KIDS: A semiautomatic program development system. IEEE Transactions on Software Engineering 16(9), 1024–1043 (1990)
Springintveld, J.: Third-order matching in the presence of type constructors. In: Dezani-Ciancaglini, M., Plotkin, G. (eds.) TLCA 1995. LNCS, vol. 902, pp. 428–442. Springer, Heidelberg (1995)
Wolfram, D.A.: The Clausal Theory of Types. Cambridge Tracts in Theoretical Computer Science, vol. 21. Cambridge University Press, Cambridge (1993)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1999 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
de Moor, O., Sittampalam, G. (1999). Higher Order Matching for Program Transformation. In: Middeldorp, A., Sato, T. (eds) Functional and Logic Programming. FLOPS 1999. Lecture Notes in Computer Science, vol 1722. Springer, Berlin, Heidelberg. https://doi.org/10.1007/10705424_14
Download citation
DOI: https://doi.org/10.1007/10705424_14
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-66677-6
Online ISBN: 978-3-540-47950-5
eBook Packages: Springer Book Archive