Ex:forth is a FORTH implementation based on pforth with the added ability to have C bindings.
It also has other stuff, but this is the reason you would want to use it over Gforth
I think that FORTH is an interesting language and I like to use it from time to time. When I do so, I like to use some graphics library (raylib) and make little games with it. The problem is, that no FORTH implementation I know of supports C bindings.
Yes, Gforth claims to support C bindings, but they are broken on every platform I try it on. This is most likely caused by Gforth devs forgetting that it's nice to make a release once in a while, so they ship a 10 years old version. You can compile the current version, but I don't like that.
It only works seamlessly on some platforms, requires a lot of additional bloat (latex, emacs...) and I prefer my projects to not require users to compile their own compiler.
This led me to making my own FORTH that supports Gforth-like runtime bindings.
I chose pforth as the base, as it is written in portable C (most implementations seem to be written in assembly for reasons) and has built-in feature to compile in new words, so it was easy to add runtime bindings.
Outside of all pforth's features and C bindings, ex:forth also adds few words. These include words for OS interaction, string manipulation, struct creation and more.
Pforth does not fully supply all standard wordsets.
Ex:forth does add a few missing words, but many are still missing. However, you should still be able to do all the things you might want to.
This is a hobby project by one guy who knows nothing about FORTH, C, or even language implementations in general. It is mainly intended to fulfill my needs and probably has few a bugs/flaws.
I do not try to sway you from using it. If you want to use C libraries with FORTH, I still believe ex:forth to be a solid choice. Just take it for what it is and don't expect perfection.
All the core parts were made by Phill Burk.
All I did was added some words and the ability to load C libraries at runtime.
Tell me if you know of any other.
Ex:forth should support all POSIX platforms, tho tests are done only on Linux. If you face any problems, feel free to report them. Windows is currently supported only via Cygwin or a similar solution.
Ex:forth uses OS specific features while loading libraries and some parts of
FORTH code are implemented only for POSIX environment.
All of these places (at least I hope) are marked with a TODO: comment.
((*ehm* *ehm*
lstodo
*ehm* *ehm*))
Windows port should be possible and I might do it at some point.
It is just not my priority right now.
- cmake (building only)
- make (also building only)
- gcc (used for bindings)
# to install globaly
cmake .
sudo make install
# or to install locally
cmake -DCMAKE_INSTALL_PREFIX="$HOME/.local" .
make install/local
This installs the standalone version as exforth.
In case you want the non-standalone version and dict, they are in fth/
This is not a FORTH tutorial, nor does it document the pforth core. There are many great FORTH tutorials online and pforth's website documents it well enough (while also containing a FORTH tutorial).
I only document the non-standard stuff I added.
- fix the underflow problems
- missing standard extensions
- search
- double (m+ m*/ 2rot 2value)
- facility (also has parts implemented)
- tools (some missing)
- xchar (maybe....)
- better debugging facility
- Native Windows support (maybe, we'll see)
