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:
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
.
If you try it and find features you need are missing or that things do not work as you expect, please let me know.
Epic is available either through the repository on github, or from hackage with the usual warnings about research quality code, etc:
git clone git://github.com/edwinb/EpiVM.git
To build it, either use Cabal, or:
make configure
make install
, to install just the API, or make
epic_install
to install the command line compiler, epic
.
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
:
lib.o
with the command epic -c
lib.e
.
main.e
with the line
include "lib.ei"
in the source.
epic main.e lib.o -o main
Edwin Brady -- eb@cs.st-andrews.ac.uk -- echo $modified; ?>