Epic - A Library for Generating Compilers

Compilers for functional languages, whether strict or non-strict, typed or untyped, need to handle many of the same problems, for example thunks, lambda lifting, optimisation, garbage collection, and system interaction. Although implementation techniques are by now well understood, it remains difficult for a new functional language to exploit these techniques without either implementing a compiler from scratch, or attempting to fit the new language around another existing compiler. Epic is a compiled functional language which exposes functional compilation techniques to a language implementor, with a Haskell API. In this paper we describe Epic and outline how it may be used to implement a high level language compiler, illustrating our approach by implementing compilers for the λ-calculus and a dynamically typed graphics language.

[1]  Edwin Brady,et al.  IDRIS ---: systems programming meets full dependent types , 2011, PLPV '11.

[2]  U. Norell,et al.  Towards a practical programming language based on dependent type theory , 2007 .

[3]  Lennart Augustsson,et al.  Cayenne—a language with dependent types , 1998, ICFP '98.

[4]  Chris Lattner,et al.  LLVM: AN INFRASTRUCTURE FOR MULTI-STAGE OPTIMIZATION , 2000 .

[5]  Neil Mitchell,et al.  Rethinking supercompilation , 2010, ICFP '10.

[6]  Simon L. Peyton Jones,et al.  Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine , 1992, Journal of Functional Programming.

[7]  Werner Kluge,et al.  Implementation of Functional Languages , 1996, Lecture Notes in Computer Science.

[8]  Manuel M. T. Chakravarty,et al.  An llVM backend for GHC , 2010 .

[9]  Simon Peyton Jones How to make a fast curry: push/enter vs eval/apply , 2004 .

[10]  Pierre Letouzey,et al.  A New Extraction for Coq , 2002, TYPES.

[11]  Frank Pfenning,et al.  Higher-order abstract syntax , 1988, PLDI '88.

[12]  Edwin Brady,et al.  Scrapping your inefficient engine: using partial evaluation to improve domain-specific language implementation , 2010, ICFP '10.

[13]  Edwin Brady,et al.  Practical implementation of a dependently typed functional programming language , 2005 .

[14]  Peter Morris,et al.  The gentle art of levitation , 2010, ICFP '10.

[15]  Brian Campbell,et al.  Amortised Memory Analysis Using the Depth of Data Structures , 2009, ESOP.

[16]  Maribel Fernández,et al.  Curry-Style Types for Nominal Terms , 2006, TYPES.

[17]  Philip Wadler,et al.  Well-Typed Programs Can't Be Blamed , 2009, ESOP.

[18]  G. G. Stokes "J." , 1890, The New Yale Book of Quotations.

[19]  Simon L. Peyton Jones,et al.  C-: A Portable Assembly Language , 1997, Implementation of Functional Languages.

[20]  Conor McBride,et al.  A Tutorial Implementation of a Dependently Typed Lambda Calculus , 2010, Fundam. Informaticae.

[21]  Marinus J. Plasmeijer,et al.  Generating Efficient Code for Lazy Functional Languages , 1991, FPCA.