The Programming Language Zoo

On this page you will find on display a number of mini languages which demonstrate various techniques in design and implementation of programming languages. The languages are implemented in Objective Caml. The source code is released under the BSD open source license (see accompanying file COPYRIGHT.txt).

I teach Theory of Programming Languages (page in Slovene) at the Faculty of Mathematics and Physics of University of Ljubljana. For the course I implemented languages which demonstrate basic concepts such as parsing, type checking, type inference, dynamic types, evaluation strategies, and compilation. My teaching assistants Iztok Kavkler and Matija Pretnar contributed to the source code as well.

The languages are not meant to compete in speed or complexity with their bigger cousins from the real world. On the contrary, they are deliberately very simple, as each language introduces only one or two new basic ideas. You should find the source code useful if you want to learn how things are done.

Visit the PL Zoo discussion at my Mathematics and Computation blog to ask a question or leave a comment.

The PL Zoo is now available through at PL Zoo repository (Mercurial).

Andrej Bauer

calc

Last update: 2008-05-06
A simple arithmetic calculator. It handles addition, subtraction, negation, multiplication and division of integers.
Download source: calc.zip
View source online ( 126 lines)

miniml

Last update: 2008-05-06
A simple eager purely functional language with integers and booleans as base types. Functions can be recursive so the language is Turing complete. Programs are compiled and executed by an abstract machine, akin to Landin's SECD machine.
Download source: miniml.zip
View source online ( 608 lines)

miniml+error

Last update: 2008-10-29
This is a variant of MiniML which has integer division and a special error value. Division by zero results in error, which then acts as an exception. There is no way to intercept error or to throw it directly.
Download source: miniml+error.zip
View source online ( 661 lines)

minihaskell

Last update: 2008-09-14
A simple lazy purely functional language. The implementation contains a parser, type-checker, and an efficient interpreter. The language has integers, booleans, lists, pairs, functions, and a general fixpoint operator.

See also Poly, which is an extension of MiniHaskell with polymorphic types and type inference.

Download source: minihaskell.zip
View source online ( 695 lines)

poly

Last update: 2008-09-14
A simple lazy purely functional language with parametric polymorphism. The implementation contains a parser, type inference, and an efficient interpreter. The language has integers, booleans, lists, pairs, functions, and a general fixpoint operator.

Poly is very similar to MiniHaskell. The only difference is that it infers polymorphic types.

Download source: poly.zip
View source online ( 772 lines)

sub

Last update: 2008-09-14
An eager purely functional language with records and subtypes. The language has integers, booleans, recursive functions, and immutable records.

Sub is an extension of MiniML.

Download source: sub.zip
View source online ( 542 lines)

boa

Last update: 2008-05-07

An object-oriented language with eager evaluation, first-class functions, and dynamic types. It is based on a notion of objects as mutable and extensible records. There are no classes.

An interesting feature of the language is that, since "everything is an object", a value may behave simultaneously as an integer, boolean, function, and a record. This is reminiscent of intersection types.

Download source: boa.zip
View source online ( 512 lines)

levy

Last update: 2012-01-08
An implementation of Paul Levy's call-by-push-value language, with recursion. This language is very precise about what gets evaluated when. Call-by-value and call-by-name can be embedded in it. See the enclosed README.txt and example.levy file for details about syntax.

Download source: levy.zip
View source online ( 584 lines)

miniprolog

Last update: 2009-01-16
A minimalist prolog interpreter. It does not contain cuts, arithmetic or lists, just basic Horn clauses.
Download source: miniprolog.zip
View source online ( 480 lines)