Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Metacompiled Forth, bootstrapping from a few lines of C.
Forth HTML Emacs Lisp Makefile C Shell Other
Branch: master
Failed to load latest commit information.
doc Hyphen in names.
experiments Rosetta code: 100 doors.
lib Add not-so-common "@+.
lisp @ 748b817 Update copyright notices.
targets Hand tune a few x86 primitives.
test Add x86 shift instructions to the assembler and use them in the nucleus.
.gitattributes Build with MSBuild.
.gitignore Test generation of PE executables.
.gitmodules Move Lisp metacompiler to separate submodule.
.travis.yml Collect all build dependency installations into a single script.
INSTALL Add more documentation.
Makefile Check that all library files are mentioned in lib/README.
README Doc updates.
appharbor.sln Build with MSBuild.
appveyor.yml New AppVeyor build image.
block.fth Fix restore-input; it should return a flag.
build.vcxproj Build with MSBuild.
core-ext.fth Add MARKER.
core.fth Factor out "CREATE.
dictionary.fth Refactored string handling.
double.fth 2NIP is not used in the kernel; move it to the DOUBLE wordset.
exception.fth Make these deferred words: ALSO, BACKTRACE, and QUIT.
facility.fth Rename .fs to .fth.
file.fth Simplify REQUIRED.
float.fth Rename .fs to .fth.
gradlew Build with continuous integration. Collect all build dependency installations into a single script.
kernel.fth COUNT is another name for C@+.
load.fth Move initial loading to a separate file.
locals.fth Rename .fs to .fth.
memory.fth Rename .fs to .fth.
packages.config Build with MSBuild.
search.fth Add MARKER.
string.fth Fix bugs in CMOVE and CMOVE>, add MOVE.
tools.fth Add MARKER.
wercker.yml Collect all build dependency installations into a single script.


( Subset of Forth94 )

The bootstrapping process uses a metacompiler written in Lisp to
target a small inner interpreter and a handful of code words written
in C.  There is also a new metacompiler written in Forth which is
intended to replace the Lisp version in the future.  Work is under way
to add a real target using assembly language code words.

( Further reading )

INSTALL          \ How to build.
doc              \ Classic (and recent) texts not related to this project.
lib/README       \ Information about libraries.
targets/README   \ Information about current and possibly future targets.

( Implementation guide )

The Forth kernel contains everything needed to read and compile the
rest of the system from source code, and not much else.  It's composed
of two parts: a target-specific file nucleus.fth containing all
primitive CODE words, and a target-independent kernel.fth.  These two
are compiled by the metacompiler.

The C target nucleus used for bootstrapping has only twelve proper
primitives.  There is also the COLD word which compiles to main(), a
signal handler, and four I/O words.

When the kernel starts, it jumps to the word called WARM.  This is
responsible for loading the rest of the system and entering the text
interpreter.  The first file loaded by WARM is core.fth, which
implements the CORE wordset.  Because the kernel only has a bare
minimum of words, the start of core.fth looks a little strange.
Something went wrong with that request. Please try again.