by Kristopher Johnson
cxxforth is a simple implementation of a Forth system in C++.
The source code is written as a tutorial for implementing Forth, similar in spirit to JONESFORTH. A Markdown-format rendition of the source code is available in cxxforth.cpp.md.
cxxforth implements a subset of the words in the ANS Forth draft standard. Refer to that document for descriptions of those words. Additional non-ANS words are described in the cxxforth source code.
This is free and unencumbered software released into the public domain. See UNLICENSE.txt for details.
Building the cxxforth
executable and other targets is easiest if you are on a
UNIX-ish system that has make
, cmake
, and Clang or GCC. If you have those
components, you can probably build cxxforth
by just entering these commands:
cd wherever_your_files_are/cxxforth
make
If successful, the cxxforth
executable will be built in the
MyFiles/cxxforth/build/
subdirectory.
If you don't have one of those components, or if 'make' doesn't work, then it's
not too hard to build it manually. You will need to create a file called
cxxforthconfig.h
, which can be empty, then you need to invoke your C++
compiler on the cxxforth.cpp
source file, enabling whatever options might be
needed for C++14 compatibility and to link with the necessary C++ and system
libraries. For example, on a Linux system with gcc, you should be able to
build it by entering these commands:
cd wherever_your_files_are/cxxforth
touch cxxforthconfig.h
g++ -std=c++14 -o cxxforth cxxforth.cpp