Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
curry-packages
icurry
Commits
4f24076b
Commit
4f24076b
authored
Apr 25, 2019
by
Michael Hanus
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Extend README
parent
9ff16ede
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
13 deletions
+56
-13
README.md
README.md
+51
-8
src/ICurry/C2I.curry
src/ICurry/C2I.curry
+3
-3
src/Main.curry
src/Main.curry
+1
-1
src/Main/Flat2I.curry
src/Main/Flat2I.curry
+1
-1
No files found.
README.md
View file @
4f24076b
IC
urry
ic
urry
======
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 language
s
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.
----------------------------------------------------------------------------
src/ICurry/C2I.curry
View file @
4f24076b
...
...
@@ -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
...
...
src/Main.curry
View file @
4f24076b
...
...
@@ -38,7 +38,7 @@ usage = do
, " outfile the ICurry output file"
, ""
, "Compile ICurry to Extended ICurry:"
, pn ++ "
compil
e [-
i
includeDir] infile outfile"
, pn ++ "
i2
e [-
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"]
src/Main/Flat2I.curry
View file @
4f24076b
...
...
@@ -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
-D
irectory",
"Look for imported modules here, using .curry
d
irectory",
Option "I" [] (ReqArg (\x-> (x,False)) "DIR")
"Look for imported modules here"]
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment