NMH's Ephemeral Page

Who am I?   |   No, Really!

New: SubC compiler updated

Learn to Program

Scheme 9 from Empty Space  [2nd edition]
S9fES is both a book and an interpreter for the R4RS Scheme programming language. The entire S9fES code is in the public domain. The book offers a guided tour through every single line of the interpreter with lots of annotations and diagrams. It covers even the gory details, such as macro expansion, call/cc, and tail-call elimination.
See also: S9fES (book version) | S9fES (current version) | play the game
Mirrors: (1 2 3 4 5); thanks!
Practical Compiler Construction  [new]
A tour through the full compiler for a clean and sane subset of the C programming language (C89), covering lexical analysis, parsing, semantics, code generation, optimization, runtime support. Including lots of annotations and diagrams. The SubC compiler discussed in the book is a fast and simple compiler that can compile itself on x86-based *BSD and Linux. Its code is in the public domain.
See also: SubC compiler page
Sketchy Scheme, 4.5th Edition (PDF)
A beginner-friendly introduction to functional programming in Scheme. This is a step-by-step guide to problem-solving in the functional way. The book contains lots of example, from trivial to advanced, as well as Scheme definitions of many standard procedures, an informal explanation of continuations, and a digression dealing with lambda calculus. Got stuck with SICP? Try this one!
Logic Programming in Scheme (PDF)  [2nd edition]
An introduction to the principles of logic programming in MicroKANREN, covering predicates, goals, negation, cutting, and the translation of functional code into declarative code. Chapter two uses logic programming to solve the well-known Zebra puzzle, and chapter three contains the complete and annotated implementation of MicroKANREN in portable Scheme.
See also: code from the book | Another MicroKANREN

The Attic

There are free PDF copies of some draft versions and obsolete books at
http://www.bcl.hamilton.ie/~nmh/t3x.org/zzz/ .

Lightweight Compiler Techniques (PDF)
A discussion of techniques for implementing simple yet efficient compilers for procedural languages. Covers all phases of compilation: scanning, parsing, optimization, code synthesis. Little theory, lots of code.
Code: T3X Compiler (final version) | T3X Compiler (book version)
Zen-Style Programming (PDF)
An introduction to various aspects of computer science at break-neck speed: functional programming, arbitrary-precision arithmetics, meta-circular evaluation, searching and sorting, the limits of computability, streams and generators, formal grammars, syntax analysis, regular expressions, logic programming, design and implementation of programming languages, and much more...
Code: Zen Lisp
Die Anatomie einer Programmiersprache (PDF)  [de]
An early precursor to Lightweight Compiler Techniques in German.
Code: BSL Compiler Kit
USELESS
An interpreter, compiler, and editor for a super-terse dialect of FORTH. Brevity = expressiveness? You decide. Lots of funny sample programs included.
MINBASIC
An interpreter and compiler for an obscure BASIC dialect that I have created back in the early 1990's. Includes some simple games as example programs. The compiler is written in MINBASIC.
Mini Scheme v.3
An extended but still tiny version of Moriwaki and Kida's Mini Scheme interpreter, featuring string operations, type checking, file operations, improved macro syntax, and more complete error checking.

contact