Copyright © 2004-2006,2008 by Marcin 'Qrczak' Kowalczyk (

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included here.

Sample Programs in Kogut

Line counts exclude comments and empty lines.

A game of Connect Four (1400 lines)

Uses text mode (curses library). Adapts to changing the terminal size (SIGWINCH). Performs game analysis also during the human player's turn.

A game of Tetris (450 lines)

Uses text mode (curses library). Adapts to changing the terminal size (SIGWINCH).

Uses a separate thread for reading the keyboard, which communicates with the main thread using Kogut signals.

KoScheme, an interpreter of Scheme (2300 lines)

Implements the R5RS standard except macros. Runs scripts from files and has an interactive read-eval-print loop. Correctness is the primary goal: deviations from R5RS are minor (except macros) and it attempts to detect as many errors in Scheme programs as possible.

Reader uses the Parsec library. The tree of s-exprs is transformed into a tree of Kogut records, which is then interpreted. The evaluator uses explicit continuation passing style. All builtin functions are implemented in Kogut.

Kokogut, a compiler of Kogut (15000 lines)

The largest Kogut program written so far. See overview and Internals.