A self-hosting mini Haskell compiler with a mini C runtime.
Haskell
80
14 commits
updated Dec 22, 2019
This is an elaboration and annotation of Ben Lynn's Haskell compiler and C VM. The main aim is to improve upon the compiler, in various layers (see Future plans).
classy.hs)String -> String, which will receive input from stdin and whose output
will be printed to the console./blynn <binary> <input> <output>
Where binary is the CL program to run, input is the
file whose contents are passed to the program, and output is the file
to write the output to.
make. That's it!To check self-compilation, run ./check.sh classy.hs. It does the
following:
classy (compiler binary) on classy.hs (compiler source),
producing classy2classy2 on classy.hs, producing classy3classy2 and classy3 are identicalIf you've made a change to what classy.hs outputs, (e.g. an
optimization to code generation), run ./check_compile.sh classy.hs
instead. It adds another step to the same process in check.sh to
ensure that the changes propagate.
putc, getc, filesystemsInitial phase; parsing and totality, then reduce heap usage.
Msgdo notation
Char and Int typesclass Functor f => Applicative f where ...)14 commits
Haskell
79.6%
C
17.4%
Shell
2.4%
A self-hosting mini Haskell compiler with a mini C runtime.
Haskell
80
14 commits
updated Dec 22, 2019
This is an elaboration and annotation of Ben Lynn's Haskell compiler and C VM. The main aim is to improve upon the compiler, in various layers (see Future plans).
classy.hs)String -> String, which will receive input from stdin and whose output
will be printed to the console./blynn <binary> <input> <output>
Where binary is the CL program to run, input is the
file whose contents are passed to the program, and output is the file
to write the output to.
make. That's it!To check self-compilation, run ./check.sh classy.hs. It does the
following:
classy (compiler binary) on classy.hs (compiler source),
producing classy2classy2 on classy.hs, producing classy3classy2 and classy3 are identicalIf you've made a change to what classy.hs outputs, (e.g. an
optimization to code generation), run ./check_compile.sh classy.hs
instead. It adds another step to the same process in check.sh to
ensure that the changes propagate.
putc, getc, filesystemsInitial phase; parsing and totality, then reduce heap usage.
Msgdo notation
Char and Int typesclass Functor f => Applicative f where ...)14 commits
Haskell
79.6%
C
17.4%
Shell
2.4%