1 A set of example programs for handling external core format.
3 In particular, typechecker and interpreter give a precise semantics.
9 The checker should work on most programs. Bugs (and infelicities)
12 1. There's some weirdness involving funny character literals. This can
13 be fixed by writing a new lexer for chars rather than using Parsec's
14 built-in charLiteral lexer. But I haven't done that.
16 2. The test driver attempts to find module dependencies automatically,
17 but it's slow. You can turn it off with the "-n" flag to the driver,
18 and specify all dependencies on the command line (you have to include
19 standard library dependencies too.)
20 * It would help to cache dependency info for standard libraries
21 in a file, or something, but that's future work.
23 3. To avoid implementing some of the I/O primitives and foreign calls,
24 I use a gross hack involving replacing certain standard library
25 modules with simplified versions (found under lib/) that depend on
26 fake "primops" that the Core interpreter implements. This makes it
27 difficult (if not impossible) to load optimized versions of standard
28 libraries right now. Fixing this is future work too.
30 Typechecking all the GHC libraries eats about a gig of heap and takes a
31 long time. I blame Parsec. (Someone who was bored, or understood happy
32 better than I do, could update the old happy parser, which is still in the
35 The interpreter is also memory-hungry, but works for small programs
36 that only do simple I/O (e.g., putStrLn is okay; not much more than that)
37 and don't use Doubles or arrays. For example: exp3_8, gen_regexps, queens,
38 primes, rfib, tak, wheel-sieve1, and wheel-sieve2, if modified so as not
39 to take input or arguments.
43 To run the checker and interpreter, you need to generate External Core
44 for all the base, integer and ghc-prim libraries. This can be done by
45 adding "-fext-core" to the GhcLibHcOpts in your build.mk file, then
46 running "make" under libraries/.
48 Then you need to edit Driver.hs and change "baseDir" to point to your GHC
51 Once you've done that:
52 1. make prims (to generate the primops file)
54 3. make nofibtest (to run the parser/checker on all nofib programs...
57 Tested with GHC 6.8.2. I make no claims of portability.