Originally published on: Tue, 04 Aug 2009
I needed a little mental exercise tonight, so I chose to write a quine ( a program that produces its own source as its output ) in the Forth programming language?
Why Forth? Because I’m a novice Forth programmer at best. I don’t think very well in Forth, so this took some effort. Here’s the quine: ( the source for this quine is in the public domain )
Originally published in Commodore Hacking electronic magazine #15, April 1998
In the early 70’s, Charles Moore designed one of the most powerful computing languages known. This language, Forth, was very different from the traditional procedural languages.
Forth is a language which allows the programmer to change most any facet of the language they wish ( including syntax extensions ).
Forth’s rapid acceptance on 8-bit microcomputers stemmed from the fact that it took a relatively small amount of memory to properly implement the language.
This post was formerly hosted at a couple of my other blogs. I’ve moved it here. It was originally posted in 2000.
If you’ve ever used a Forth compiler, chances are you’ve heard the name Tom Zimmer. Tom’s been a staple in the Forth community for a few decades. Tom developed a number of Forth systems for popular 8-bit microcomputers that dominated the home-computer market in the 80’s.
Tom is the creator of the freeware Win32Forth system.
I built a non-Turing-complete interpreter in Go whose current incarnation is simply named “rpnrepl”. rpnrepl is a very tiny stack-based, postfix language whose syntax is similar to that of the Forth programming language.
rpnrepl can only perform four mathematical operations, display the topmost item on the stack, display a newline, and exit the running program.
Unlike Forth whose grammar can change dynamically, rpnrepl does have a simple grammar. Words are separated by spaces unless bound by single quotation-marks or double quotation-marks.
When I first began using microcomputers in the late 1970’s, development tools for 8-bit machines were precious and mysterious commodities. Most of these sorts of tools that looked to be useful were very expensive. My usage of most of these tools was driven by budgetary constraints.
The Gateway Drug : BASIC
All it really took to pique someone’s interest in microcomputers was to show them a simple program such as:
I was a senior in high-school in the mid-1980’s when I first encountered a dialect of the Forth programming language. I was quite familiar with BASIC and Z-80 assembly-language and was just beginning to hand-assemble some 6502 code.
One of my instructors brought in King Microware Tiny Forth for the Commodore 64 computer in her lab.
I was intrigued, at first, and tried to tinker with Forth. The booklet that came with Tiny Forth described the following line of code that I was supposed to enter at the OK prompt:
Several years ago, I created a Forth-like programming language interpreter called FIF ( FIF Isn’t Forth ). I put FIF aside for a while as other events began to consume my time. I ultimately ended up losing all of the source code that I had built to that point.
I had pondered trying to recreate it, but the work I had done in making FIF opened my eyes to things that I’d want to do differently.