6091935d4a02a10165321a6a56dfdb9429b8fa33
[ghc-hetmet.git] / utils / ext-core / README
1 A set of example programs for handling external core format.
2
3 In particular, typechecker and interpreter give a precise semantics.
4 ---------------------
5 tjc April/May 2008:
6
7 ==== Notes ====
8
9 The checker should work on most programs. Bugs I'm aware of:
10 1. There's some business I don't quite understand involving
11    coercions and subkinding (for details, see:
12    http://www.haskell.org/pipermail/cvs-ghc/2008-April/041949.html)
13    This shows up when typechecking a few of the library modules.
14    
15 2. There's some weirdness involving funny character literals. This can
16    be fixed by writing a new lexer for chars rather than using Parsec's
17    built-in charLiteral lexer. But I haven't done that.
18
19 3. When typechecking the ghc-prim:GHC.PrimopWrappers library module,
20    some declarations seem to have the wrong type signature (due to 
21    confusion between (forall (t::*) ...) and (forall (t::?) ...).)
22    This is because the ? kind is not expressible in Haskell.
23
24 Typechecking all the GHC libraries eats about a gig of heap and takes a
25 long time. I blame Parsec. (Someone who was bored, or understood happy
26 better than I do, could update the old happy parser, which is still in the
27 repo.)
28
29 The interpreter is also memory-hungry, but works for small programs
30 that only do simple I/O (e.g., putStrLn is okay; not much more than that)
31 and don't use Doubles or arrays. For example: exp3_8, gen_regexps, queens,
32 primes, rfib, tak, wheel-sieve1, and wheel-sieve2, if modified so as not
33 to take input or arguments.
34
35 ==== Building ====
36
37 To run the checker and interpreter, you need to generate External Core
38 for all the base, integer and ghc-prim libraries. This can be done by
39 adding "-fext-core" to the GhcLibHcOpts in your build.mk file, then
40 running "make" under libraries/.
41
42 Then you need to edit Driver.hs and change "baseDir" to point to your GHC
43 libraries directory.
44
45 Once you've done that:
46 1. make prims (to generate the primops file)
47 2. make
48 3. make nofibtest (to run the parser/checker on all nofib programs...
49    for example.)
50
51 Tested with GHC 6.8.2. I make no claims of portability.
52
53