Introduction | Where to get it | Documentation
ESC, the Epigram Supercombinator Compiler, is a simple functional language which compiles to efficient (well, maybe!) 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.
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:
lazy annotation if
that's what you need.
Con 2 (x,y,z) is a constructor taking three
arguments, with tag 2.
';' is a sequencing operator, for sequencing side
effecting expressions.
Int, Float,
BigInt, BigFloat,
Char and String, although
only Int, BigInt and String work so far; comparison
operators
work on Int.
Future plans are, in no particular order: optimisations (tail calls especially), reduction under lambdas (a la Gregoire & Leroy), more primitive types, dynamic loading of compiled code, unboxed values, control of evaluation order, arbitrary precision arithmetic, better C API, etc ...
For now, just a darcs repository, with the usual warnings about research quality code, etc:
darcs get --partial
http://www-fp.dcs.st-and.ac.uk/~eb/darcs/EpiVM/
To build it:
Makefile to set an appopriate prefix; the
default is to install in ~/bin and ~/lib.
make configure
make install, to install just the API, or make
esc_install to install the command line compiler, esc.
You'll need GHC 6.4, 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 sarge) 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, esc 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:
lib.o with the command esc -c
lib.e.
main.e with the line
include "lib.ei" in the source.
esc main.e lib.o -o main
Edwin Brady -- eb@cs.st-andrews.ac.uk -- 23rd July 2006