Installation

Installing the compiler and standard library

Compiling

CMake, Make, a C++17 compatible compiler (GCC >= 7), and an assembler that uses AT&T syntax are required.

Run the following commands to build the compiler:

$ mkdir build && cd build
$ cmake ..
$ make

Then use the compiler to bootstrap the standard library:

$ cd .. # in the root directory now
$ make # forthc needs to be located in build/forthc

You should now be ready to compile your first program! Write the following in a forth file

hello.forth
: main
"Ciao, Mondo!\n" puts
;

And build it with the following commands:

$ forthc hello.forth | as -o hello.o -
$ ld hello.o /usr/lib/forth/libfstd.a -o hello
$ ./hello
Ciao, Mondo!