." Hello world!"
Xforth is intended to ease the use of FORTH on modern systems. It has a tiny codebase, and adding more native features easily is a priority. It is not ANSI compliant, however it is designed in a way that I believe to be superior, in both minimalism and ease of use.
- Simplicity
- Efficiency
- Minimalism
This project requires GNU make, gcc, and ruby. All of the language is written in C, however the extension mechanism uses ruby to parse the C files.
Simply type make
. To rapidly test new additions, make run
will build and start the interpreter. To install (unix-like only), sudo make install
.
A simple frontend is provided in frontend/xforth.rb
. To run after installation, simply try xforth repl
. If you add another entry point in the C code, you can use that as your entry point instead of repl
.
Though described in much more details in doc/extend.txt
, a simple example is:
//This code will add a new word named rot to the language via C
//g r rot rot
void rot(){
//^Note that the bracket trails the function name
unsigned int a, b, c;
a = pop();
b = pop();
c = pop();
push(c);
push(b);
push(a);
}
( if you've ever used forth before, you'll feel right at home)
." This will print this string"
1 2 + . ( This will add these two numbers and print them)
This is not a replacement for Gforth, however it is intended to make interactions with modern OSs easier. Support for real files etc. is in the works, and I plan to release a fork with sockets eventually.
Happy Hacking!