Abstract
Extending a programming language by new language constructs often implies extending its compiler by additional machinery. To reduce the complex interweaving of compiler and extension implementations we present a simple and modular concept of lifting the often needed additional preprocessing out of the base compiler implementation. Avoiding the introduction of standalone tools, this preprocessor framework for extensions of Haskell is designed as a separate portable library of monadic preprocessing functions based on Template Haskell. Additional preprocessing passes expressed in this framework can then much easier be carried along the series of ever advancing base compiler versions. Taking Eden, a parallel programming extension of Haskell, as an example we show that besides achieving improved portability and reusability pass code sizes can be reduced considerably.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
Peyton Jones, S., et al.: Haskell 1998: A Non-strict, Purely Functional Language (2003), See: http://www.haskell.org/definition
Czarnecki, K., et al.: Generative Programming and Active Libraries. In: Jazayeri, M., Musser, D.R., Loos, R.G.K. (eds.) Dagstuhl Seminar 1998. LNCS, vol. 1766, p. 25. Springer, Heidelberg (2000)
Loogen, R., Ortega-Mallén, Y., Peña, R.: Parallel Functional Programming in Eden. Journal of Functional Programming, Special Issue on Functional Approaches to High-Performance Parallel Programming (2004) (to appear)
Peyton Jones, S., et al.: The Glorious Glasgow Haskell Compilation System, Version 6.4 (2005), Available at: http://www.haskell.org/ghc
Berthold, J., Klusik, U., Loogen, R., Priebe, S., Weskamp, N.: High-level Process Control in Eden. In: Kosch, H., Böszörményi, L., Hellwagner, H. (eds.) Euro-Par 2003. LNCS, vol. 2790, pp. 732–741. Springer, Heidelberg (2003)
Berthold, J.: Towards a generalised runtime environment for parallel haskells. In: Bubak, M., van Albada, G.D., Sloot, P.M.A., Dongarra, J. (eds.) ICCS 2004. LNCS, vol. 3038, pp. 297–305. Springer, Heidelberg (2004)
Nordin, T., Peyton Jones, S.L.: Green card: a foreign-language interface for Haskell. In: Proceedings of the Haskell Workshop, Amsterdam, Netherlands (1997)
Reid, A.: Template Greencard. In: Proceedings of 15th International Workshop on the Implementation of Functional Languages (IFL 2003), Edinburgh (2003)
Sheard, T., Peyton Jones, S.: Template Meta-programming for Haskell. In: Haskell Workshop 2002. ACM Press, New York (2002)
Wadler, P.: Comprehending monads. In: Mathematical Structures in Computer Science, vol. 2, pp. 461–493 (1992)
Jones, M.P.: Functional Programming with Overloading and Higher-Order Polymorphism. In: Jeuring, J., Meijer, E. (eds.) AFP 1995. LNCS, vol. 925, pp. 97–136. Springer, Heidelberg (1995)
Klusik, U., Loogen, R., Priebe, S.: Controlling Parallelism and Data Distribution in Eden. In: Trends in Functional Programming (Selected papers of the Second Scottish Functional Programming Workshop), Intellect, vol. 2, pp. 53–64 (2000)
Trinder, P.W., Hammond, K., Loidl, H.W., Peyton Jones, S.L.: Algorithm + Strategy = Parallelism. In: Kluge, W. (ed.) Workshop on the Implementation of Functional Languages, Bonn, Germany, Universität Kiel (1996)
Backhouse, R., Jansson, P., Jeuring, J., Meertens, L.: Generic Programming – An Introduction. In: Swierstra, S.D., Henriques, P.R., Oliveira, J.N. (eds.) AFP 1998. LNCS, vol. 1608, pp. 28–115. Springer, Heidelberg (1999)
Lynagh, I.: Template Haskell: A report from the field. Unpublished. Available from the author’s web page (2003)
Lynagh, I.: Unrolling and simplifying expressions with Template Haskell. Unpublished. Available from the author’s web page (2003)
Seefried, S., Chakravarty, M., Keller, G.: Optimising Embedded DSLs using Template Haskell. In: Karsai, G., Visser, E. (eds.) GPCE 2004. LNCS, vol. 3286, pp. 186–205. Springer, Heidelberg (2004)
Peyton Jones, S., Tolmach, A., Hoare, T.: Playing by the Rules: Rewriting as a practical optimisation technique in GHC. In: Haskell Workshop (2001)
Tolmach, A., et al.: An External Representation for the GHC Core Language (Draft for GHC 5.02 documentation) (2001)
Veldhuizen, T., Gannon, D.: Active libraries: Rethinking the roles of compilers and libraries. In: Proceedings of the SIAM Workshop on Object Oriented Methods for Interoperable Scientific and Engineering Computing, OO 1998 (1998)
Norell, U., Jansson, P.: Prototyping Generic Programming in Template Haskell. In: Kozen, D. (ed.) MPC 2004. LNCS, vol. 3125, pp. 314–333. Springer, Heidelberg (2004)
Lämmel, R., Peyton Jones, S.: Scrap your Boilerplate: A Practical Design Pattern for Generic Programming. In: Proceedings of ACM Sigplan Types in Language Design and Implementation, TLDI (2003)
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2005 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Priebe, S. (2005). Preprocessing Eden with Template Haskell. In: Glück, R., Lowry, M. (eds) Generative Programming and Component Engineering. GPCE 2005. Lecture Notes in Computer Science, vol 3676. Springer, Berlin, Heidelberg. https://doi.org/10.1007/11561347_24
Download citation
DOI: https://doi.org/10.1007/11561347_24
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-29138-1
Online ISBN: 978-3-540-31977-1
eBook Packages: Computer ScienceComputer Science (R0)