[Best viewed with any browser]

Epic - a Supercombinator Compiler

Introduction | Where to get it | Documentation


Epic is a simple functional language which compiles to reasonably efficient C code. The primary aim is to develop a back end for Epigram, but it will (I hope, eventually) be useful to anyone looking for a back end for a functional language. It is currently used as a back end for Idris.

Programs consist of a number of supercombinator definitions, e.g. the canonical factorial example or this list program. The main function is evaluated when the program is run. Some important language features to note:

If you try it and find features you need are missing or that things do not work as you expect, please let me know.

Where to get it

Epic is available either through the repository on github, or from hackage with the usual warnings about research quality code, etc:

To build it, either use Cabal, or:

You'll need an up to date GHC, happy, the Boehm garbage collector library and the GNU MP arithmetic library. You'll also need gcc, since the compiler outputs C code. Please let me know how you get on! I've tested this on Linux (Debian and Ubuntu) and Mac OS X 10.4. Packages for all the required libraries are available for both.


There is an API (haddock generated documentation) and a command line tool. The API is currently minimal, but will eventually be extended to allow building of syntax trees from Haskell programs, rather than requiring an ASCII source file.

The command line tool, epic takes a source file and produces executable code, via C. Separate compilation is supported, in a fairly simple way, e.g. to compile a main program main.e which includes some functions defined in lib.e:

Edwin Brady -- eb@cs.st-andrews.ac.uk --