A few years ago I wrote a literate FORTH compiler and tutorial called JONESFORTH. It’s a good way, I think, to understand the power and limitations of FORTH, and a good way to learn a completely different and mind-blowing programming language.
If you’ve not heard of FORTH before, cogitate on this: It is possible to write a FORTH program in 2,000 lines. A program which will boot and provide an entire development environment (inc. editor, compiler etc) on bare hardware.
Anyhow, I just uploaded my semi-private CVS repository to git. You can find it here:
http://git.annexia.org/?p=jonesforth.git;a=summary
The original tutorial is in two parts:

Hi,
thanks for your fantastic work.
I’m using it as a starting point in my next project. It will be used as a vm of a compiler.
http://github.com/chengchangwu/sparkforth
http://github.com/chengchangwu/gefc
According to the work of Richard Russell on bb4wforth, version 47 of jonesforth has a bug in /MOD which is easy to fix. The fix proposed by Richard is
defcode “/MOD”,4,,DIVMOD
pop %ebx
pop %eax
cdq
idivl %ebx
push %edx // push remainder
push %eax // push quotient
NEXT
Another fix is the U. in file jonesforth.f which should uses U/MOD instead of /MOD. The proposed change of Richard is to add U/MOD to jonesforth.S and to modify the U. accordingly.
defcode “U/MOD”,4,,UDIVMOD
xor %edx, %edx
pop %ebx
pop %eax
divl %ebx
push %edx // push remainder
push %eax // push quotient
NEXT
: U. ( u — )
BASE @ U/MOD ( width rem quot )
?DUP IF ( if quotient 0 then )
RECURSE ( print the quotient )
THEN
( print the remainder )
DUP 10 < IF
'0' ( decimal digits 0..9 )
ELSE
10 – ( hex and beyond digits A..Z )
'A'
THEN
+
EMIT
;
Will you fix this bugs in the git respository?
Do you accept any patch?
Cheng-Chang Wu
Execute me, the length of U/MOD is 5, not 4.
According to Richard’s work, jonesforth’s implementations of /MOD and U. have bugs, implementations of DEPTH, .S, HERE, ALLOT, CREATE, VARIABLE, TRUE, FIND, WHILE, REPEAT, WORD, KEY and ‘ are not compliance with ANS Forth. I’m planning to change these and only these, to keep jonesforth’s minimalism and to pave the way for ANS Forth compliance.
In other words, to make ANS Forth a natural extension of jonesforth.
If you agree, I can send you my patch after I have finished it.
What I suggest you (and anyone else) do is to set up a git repo and/or website with whatever changes you want to make. Let me know about the new site and I’ll add a link to it on the main website.
yes, I’ve set up a git repo at github.
http://github.com/chengchangwu/jonesforth
My first move is to remove/reimplement the inconsistent part of jonesforth. Please see the non-standard core word section in TODO to know what I’ve done.
Interesting to see your attempts Cheng-Chang Wu,
do you have a contact e-mail?
Pingback: Daniel’s Stuff » The Funky Clock
Hi Rich. The annexia links are broken.
You can still grab the source from
http://git.annexia.org/?p=jonesforth.git;a=summary
Hi Rich.
This : http://git.annexia.org/?p=jonesforth.git;a=summary
links are broken .
Please check it.
Seems to be working fine, albeit slowly, for me.
git://git.annexia.org/git/jonesforth.git <– I can't clone from this URL
It should work now. Debian (or git) changed the way git-daemon works so now the git directory has to contain the empty file
git-daemon-export-okotherwise it refuses to allow people to clone it.Still not working
[tesla:~/Source] git clone git://git.annexia.org/git/jonesforth.git
Cloning into jonesforth…
git.annexia.org[0: 94.30.104.162]: errno=Operation timed out
fatal: unable to connect a socket (Operation timed out)
OK so the hosting place lost power over this holiday weekend, and the machine didn’t come back up. It’s working now.
Awesome, it worked. Made a GitHub mirror here: https://github.com/nornagon/jonesforth
Thanks!
Hi guys, just checking in. Glad to see fresh FORTH faces. 40+ years a FORTH-er here. Anyone into colorFORTH and the new greenarrays chip? Hairy stuff! Cheers, Clyde
I’ve been porting JonesForth.S and JonesForth.f to Windows.
Are you interested in reviewing my work before I publish it?
I’m not sure I would know what to review for a Windows port, so I suggest publish away.
Let us know when you have decided and what we can do to assist you.
I suppose I should have been more specific about what I thought Rich might want to review. Specifically, his tutorial prose has been significantly edited and so I wanted Rich to have an opportunity to see those changes before publication. I am still in the process of making the system more ANS compliant, so I’m not yet ready to publish. However, if anyone would like an advance copy, please drop me a note: mailto:jlarson43@juno.com
I’d say just go ahead and publish. It’s public domain after all — designed to be distributed with the least friction possible.
Ok, Forth Fans:
http://www.dst-corp.com/james/JonesForthInC-V148.html
This isn’t the finished version, but something I hope will generate some buzz.
Excellent tutorial!
I had some trouble running this, but once I followed the comment by Arto Bendiken posted at http://subvert-the-dominant-paradigm.net/blog/?p=54, “make test” works fine.
“Note that if you attempt to run this on recent versions of Linux and the program simply aborts and prints out “Killed”, you will need to recompile without the “-Wl,-Ttext,0″ option to GCC.”
Thanks — I wonder what changed. Note that we do assume the text starts at address zero.