Commit 4f24076b authored by Michael Hanus 's avatar Michael Hanus

Extend README

parent 9ff16ede
ICurry
icurry
======
ICurry is an intermediate format to compile Curry to different imperative
languages.
Its purpose is to be mostly generic, so any target language can be supported
with a similar effort.
Its purpose is to be mostly generic so that different target languages
can be supported with a similar effort.
The definition of ICurry is inspired by the Curry compiler
[Sprite](http://dx.doi.org/10.1007/978-3-319-63139-4_6)
which compiles Curry programs into LLVM code.
The `icurry` package includes a format `ICurry` (see `ICurry.Types`),
a format `Extended ICurry` (see `ICurry.Extended.Types`), a translator
from Flat- to ICurry, from I- to Extended ICurry, some goodies for
dealing with (Extended) ICurry structures and parts to quickly create a build
system based on Ninja.
The `icurry` package supports two kinds of intermediate formats:
* `ICurry` (see `ICurry.Types` for detailed definitions)
* `Extended ICurry` (see `ICurry.Extended.Types` for detailed definitions)
The package also contains a translator from FlatCurry to ICurry programs
(which have the suffix `.icy`), a translator from ICurry to
Extended ICurry programs (which have the suffix `.eicy`), some goodies for
dealing with (Extended) ICurry structures and auxiliary to quickly
create a build system based on Ninja (see package `ninja`).
The translators are available in the `icurry` binary installed
with this package.
Usage:
------
In contrast to other general compilers which can translate
complete applications consisting of several modules,
the `icurry` compiler translates only single modules
so that it should be used as a tool invoked by
appropriate build tools (e.g., `ninja`, `make`).
In particular, before compiling some module, all its
imported modules have to be compiled so that their interfaces
(data and function types) are already stored in
ICurry type dependencies files (suffix `.ictdeps`).
For instance, to compile the Prelude manually,
one can change to the library directory containing
the file `Prelude.curry` and invoke the following commands:
1. Generate `Prelude.tfcy` (the typed FlatCurry file of the Prelude):
> pakcs-frontend -i "." --typed-flat Prelude
or
> kics2-frontend -i "." --typed-flat Prelude
2. Generate `Prelude.icy` (the ICurry representation of the Prelude,
which also generates the ICuury type dependency file `Prelude.ictdeps`):
> icurry f2i -I ".curry" .curry/Prelude.tfcy .curry/Prelude.icy
3. Generate `Prelude.eicy` (the Extended ICurry representation of the Prelude):
> icurry i2e -I ".curry" .curry/Prelude.icy .curry/Prelude.eicy
Now one can compile modules using the Prelude in the same way.
----------------------------------------------------------------------------
......@@ -437,9 +437,9 @@ e2i ms tm ng v fargs caseE@(ACase ty t e bs) =
let
(e', vs', as', fs', ng') = e2i ms tm ng v fargs e
(nv, vs'', as'') = case e' of
IVar idx -> (idx, vs', [])
otherwise -> let nv = newVar (v ++ allVars caseE)
in (nv, vs'++[nv], as' ++ [(nv, e')])
IVar idx -> (idx, vs', [])
_ -> let nv = newVar (v ++ allVars caseE)
in (nv, vs'++[nv], as' ++ [(nv, e')])
(ng'', ng''') = extendName ng'
(f@(fname,_,_,_,_),vs) = lambdaLift ms tm ng''' (ACase ty t (AVar ty nv) bs)
in
......
......@@ -38,7 +38,7 @@ usage = do
, " outfile the ICurry output file"
, ""
, "Compile ICurry to Extended ICurry:"
, pn ++ " compile [-i includeDir] infile outfile"
, pn ++ " i2e [-I includeDir] infile outfile"
, " -I includeDir specify a directory to look for included modules"
, " infile the ICurry input file"
, " outfile the Extended ICurry output file"]
......@@ -59,6 +59,6 @@ pmain args = do
optDescrs :: [OptDescr (String, Bool)]
optDescrs = [
Option "i" [] (ReqArg (\x-> (x,True)) "DIR")
"Look for imported modules here, using .curry-Directory",
"Look for imported modules here, using .curry directory",
Option "I" [] (ReqArg (\x-> (x,False)) "DIR")
"Look for imported modules here"]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment