A while back I was working on a compiler for an experimental programming language (<plug>Cowbel</plug>). For some reason I seem to have thought that targeting GNU Make script was a good idea for testing. (Back then the language was called sake.)

Before I finally realised that what I was doing was totally insane, I got as far as writing most of an arbitrary precision maths library as a set of Make macros and, of course, this:

Conway's Game of Life (in make) 22 kB

Remember that you do need a real copy of GNU Make. BSD Make won't work.

Run with:

make -f life.mk

It's implemented as a single incredibly complex Make macro; it doesn't shell out to any external processes. This means it's totally portable! Most of the complexity is because Make macros don't actually support arithmetic and we have to emulate it. It's also interesting to watch make run it. There are some odd performance characteristics I haven't nailed down yet --- loops seem to get slower as they run, for example.

For interest value, here's the source file I compiled.

Conway's Game of Life (in sake)

It will, of course, be totally useless without the compiler.

If you look at that file, it's pretty obvious which bits are the run-time library and which bits are generated by the compiler. It's faintly possible that the run-time library may be faintly useful to someone --- it's got library routines for doing arithmetic on integers in Make script, for example (although I haven't done division). So:

sake run-time library

Documentation? Muahahaha! But there are some comments.

And if you actually want the compiler, which is old and buggy and incomplete and unsupported and unmaintained and written in Java, here it is. It's a tagged branch in the main cowbel repository:

sake compiler

Link to sake compiler source. Do not use.