Self-hosting metacompiled Forth, bootstrapping from a few lines of C; targets Linux, Windows, ARM, RISC-V, 68000, PDP-11, asm.js.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Lars Brinkhoff 00aa97948c Move definition of h-[defined]. 5 years ago
contrib Run some benchmarks from Gforth. 6 years ago
doc Document the metacompiling build process. 5 years ago
experiments Some hash functions. 5 years ago
lib Hooks for compiler targets. 5 years ago
lisp@40b99c0962 Fix problems bootstrapping with CLISP. 6 years ago
src Move definition of h-[defined]. 5 years ago
targets fix 5 years ago
test fix 5 years ago
.gdbinit Update .gdbinit for the new x86 word header structure. 7 years ago
.gitattributes OPEN-FILE file name doesn't have to be NUL-terminated. 7 years ago
.gitignore Makefile target for generating web files. 6 years ago
.gitlab-ci.yml Move test-related files to test directory. 5 years ago
.gitmodules Fix Lisp metacompiler submodule URL. 6 years ago
.scrutinizer.yml Move test-related files to test directory. 5 years ago
.travis.yml Move test-related files to test directory. 5 years ago
INSTALL Improve build instructions. 6 years ago
LICENSE GPL3 7 years ago
Makefile Split off kernel-specific code from metacompiler. 5 years ago
PITCHME.md Add information about the cross compiler. 5 years ago
README.md Add information about the cross compiler. 5 years ago
appharbor.sln Make AppVeyor do both x32 and x64 builds. 7 years ago
appveyor.yml Update Cygwin to 2.2.1. 7 years ago
bitrise.yml Move Bitrise configuration to a file. 5 years ago
build.md Move Bitrise configuration to a file. 5 years ago
build.vcxproj AppVeyor build workarounds: 6 years ago
circle.yml Move test-related files to test directory. 5 years ago
configure Fixes to build with an ARM host. 6 years ago
packages.config Update Cygwin to 2.2.1. 7 years ago

README.md

( Subset of Forth94 )

This is a self-hosted implementation of Forth, which can regenerate itself from Forth source code. The bootstrapping process uses a metacompiler written in Lisp to target a small inner interpreter and a handful of code words written in C. A new metacompiler written in Forth generates an x86 executable using using assembly language code words.

There are also ARM, RISC-V, Motorola 68000, PDP-11, and asm.js targets. There is a cross compiler for 6502, 8051, AVR, Cortex-M, MSP430, PDP-8, PIC, and STM8.

( Continuous integration )

The code is continuously built and tested in Linux, MacOS X, and Windows using several cloud-based continuous integration services. This is documented in build.md.

( Further reading )

INSTALL \ How to build.
doc \ Classic (and recent) texts not related to this project.
lib/README \ Information about libraries.
targets/README.md \ 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(), 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.