A simple public-domain Forth implementation in C++
C++ CMake Forth Makefile C
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
cmake_modules
tests
xcode/cxxforth.xcodeproj
.gitignore
CMakeLists.txt
Makefile
README.md
UNLICENSE.txt
cpp2md.fs
cxxforth.cpp
cxxforth.cpp.md
cxxforth.h
cxxforthconfig.h.in

README.md

cxxforth: A Simple Forth Implementation in C++

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 cxxforth

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