A while back I stumbled upon this very cool, and tiny, implementation of forth. Why learn forth? The introductory comments explain why quite elegantly:
LISP is the ultimate high-level language, and features from LISP are being added every decade to the more common languages. But FORTH is in some ways the ultimate in low level programming. Out of the box it lacks features like dynamic memory management and even strings. In fact, at its primitive level it lacks even basic concepts like IF-statements and loops.
The introduction goes on to explain that not only is forth minimal, but it also supports extending it in dramatic ways. If you are ever in a situation where a low level language is called for (say programming your robot legos), then forth should be your language of choice.
The tutorial also provides you with a working demonstration of another language: i386 Assembly. The forth interpreter is written in assembly, a language I've never really got comfortable with. One reason why, no doubt, is the lack of substantial examples. Well, that's no longer the case.
If I can fully understand the implementation I'll be a lot closer to understanding both these languages on a much deeper level.
I'm tempted to bust out my ancient HP 200 LX (aka Billy) and see if I can get the assembly to compile on it. Then I'd have a forth interpreter I could carry around with me. Exciting thought, isn't it?
No comments:
Post a Comment