5 ms·
I wrote jonesforth which is a simple threaded FORTH (in other words, interpreted and certainly not a modern FORTH). Threaded interpreters produce compact code.
by rwmj 8y ago
I wrote jonesforth which is a simple threaded FORTH (in other words, interpreted and certainly not a modern FORTH). Threaded interpreters produce compact code. They are not efficient on modern CPUs, because they interact badly with branch prediction. For embedded cases where memory is at a premium and you usually have a simple CPU like an Arduino, FORTH is a great fit still.
Modern FORTHs are all compiled (as indeed are modern Javascripts). In my view FORTH is a pretty horrible language to write code in, and if you lose the advantage of the compact code for the embedded case then you might as well use a nice compiled language - whatever is your preference, but my preference would not be FORTH if I had to write code all day long in it.
- sbjs 8y agoI wonder if the same semantics that make Forth simple and fast can be used with another (higher-level) syntax to make it easier to write in, kind of like how C replaced Assembly. It could become a new family of languages that might rival modern high-level languages in the same way CL Lisp tried to shake things up by being both low-level and high-level at the same time.
- vanderZwan 8y agoYou might be interested in looking up concatenative languages. There's a wiki[0]. I really like Joy in the abstract sense. Factor made a few waves a decade ago but has kind of lost steam[1]. It's still being developed though[2]. Kitten looks promising but develops at a snail pace because it's one guy doing it[3]. Not a dig against him, mind you! [0] http://concatenative.org/wiki/view/Front%20Page http://concatenative.org/wiki/view/Front%20Page [1] http://factorcode.org/ http://factorcode.org/ [2] https://github.com/factor/factor/ https://github.com/factor/factor/ [3] http://kittenlang.org/ http://kittenlang.org/
- AstroJetson 8y agoJonesforth is a great tool when trying to teach people how stack based interpreters would work. I used it as an example in a class that I taught. The documentation is first rate with exact descriptions in the code. As far as the FORTH being a horrible language, to some extent it is. But if you are stuffing into a small chipset it's good. Granted there are things like Lua now, but back in the early years, FORTH was a huge tool for imbedded systems.
- eadmund 8y agoI look at Forth as a great portable assembler in which to write another expressive language (e.g. a Lisp or Smalltalk) in.