NMH's Ephemeral Page

Who am I?   |   No, Really!

mLite, a lightweight functional language

Learn to Program

Practical Compiler Construction
This book offers 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, and runtime support, including lots of clarifying annotations and diagrams. The SubC compiler discussed in the book is in the public domain and can be downloaded below.
The SubC Compiler
SubC is a clean, fast, and simple compiler for a subset of C89 that can compile itself on various BSDs, Linux, Windows, and other systems. It also cross-compiles to DOS. Its code is in the public domain.
Scheme 9 from Empty Space (Book, Interpreter)
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.
mLite, a lightweight, dynamic functional language
mLite is a general-purpose, functional, lightweight, dynamic programming language. It borrows ideas from both the Scheme and Standard ML languages, taking most of its syntax from ML and its dynamic nature from Scheme. It extends ML-style pattern matching by adding guarded patterns and also introduces the principle of "implicit guards".
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)
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

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)
An early precursor to Lightweight Compiler Techniques in German.
Code: BSL Compiler Kit
An interpreter, compiler, and editor for a super-terse dialect of FORTH. Brevity = expressiveness? You decide. Lots of funny sample programs included.
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.
Lindberg's FOOGOL IV compiler hacked up to emit 386 assembly language. Also converted to modern (ANSI 89) C. Compiles fine with SubC.
PD Korn Shell
A slightly patched version of pdksh, compiles on most modern BSD's and has a clear-screen function that you can bind to a key. This was the one tcsh feature I was missing most in pdksh. And: yes, I actually use this shell. :-)