The unbearable lightness of Forth

I mentioned Forth [1] in conjunction with bootstrapping a language [2] and I think it would be constructive to show just how small Forth can be. I'm referencing JONESFORTH [3], an implemention of Forth bootstrapped from assembly language. It took only 2,313 lines of assembly for JONESFORTH (and easily half of that is comments describing the inner workings of the Forth environment) versus the 3,663 lines of assembly for the first stage of amber [4] (the other language mentioned the other day).

Now, granted, the first stage of amber is usable as is, whereas JONESFORTH takes another 1,788 lines of code in Forth (and again, about half is just comments describing the implementation) to get a near fully fledged Forth system (JONESFORTH does not support DOES> and why that is important will take another post).

So yes, Forth is pretty easy to bootstrap. (and small—the JONESFORTH executable is only 17K (kilobytes)—when was the last time you saw a compiler that small?)

[1] https://en.wikipedia.org/wiki/Forth_(programming_language)

[2] /boston/2015/06/11.2

[3] https://rwmj.wordpress.com/2010/08/07/jonesforth-git-repository/

[4] https://github.com/nineties/amber

Gemini Mention this post

Contact the author