Very happy to see young people still fooling with this stuff, despite the ubiquity of smart phones etc.
I just uploaded the code to github: https://github.com/hoytech/tiforth
To anyone else interested in really understanding forth, Brad Rodriguez's "Moving Forth" series is the best I've ever read (and I don't imagine much has changed since), including a great explanation on "DOES>", widely regarded as the most difficult part of the forth kernel. You can read it online here:
Also I have to confess I stole the division routine for my forth from Brad's CamelForth: https://github.com/hoytech/tiforth/blob/master/forth.z80#L50...
Quickly looking it over I notice I used m4 as the macro-expander (haha I've since grown out of that).
Essentially you start out writing some assembly definitions as named routines and once those are defined you start using that. Forth doesn't have a compiler in the traditional sense. Rather it has a dictionary with stored definitions that you either run from or add to. Besides that, your main data structure is the stack. So your code reads from the stack, does some calculation, returns data to the stack, and calls the next word. This can be very powerful as the implementor can truly understand the entire language. Who can say that about C, Python...etc? With that being said, the whole thing is super Spartan, so unless you implemented a feature, it isn't there. So although Forth is cool, the scientific work I do with matrices would require me to rewrite all of that in my Forth, so it would be a non-starter. Forth really shines for hardware work in my opinion.
Look at JonesForth as an intro to building your own Forth, and Leo Brodie's books on how to use Forth. Every Forth system written probably shares the same core design, but they are all different and as unique as snowflakes. Look at 8th as an example of a very affordable commercial Forth based language written by one man that can cross compile to Windows, Linux, BSD, Mac, Android, & iPhone , has a built-in GUI, encrypted binaries, is pretty speedy and well supported with a small but happy user base. It is an interesting point that there are few languages with that level of features and stability that are not made from the work of lots of people.
Yeah, which supposedly brings one of the big downsides of Forth, which is that one easily ends up with a program that has been refactored too aggressively into smaller words.
Assembly? You can bootstrap it in machine code! :)
IMHO Forth is more like an even more reduced Lisp, a "reverse Lisp" if you want, because of Forth's stack architecture (instead of (+ 1 2) in Lisp to add the number 1 and 2, you would write "2 1 +" in Forth, this puts the numbers 2 and 1 on the "stack", and then executes the word "+", which takes the topmost 2 numbers from the stack, adds them, and puts the result back on the stack.
So you get many advantages of Lisp (building complex programs incrementally from very simple building blocks), but in a much more reduced package which can even run on 8-bit computers with just a few KB of memory.
RPN is Forth-like in that they're both stack based. Their 28/48/49/50G line shipped with RPL(Reverse Polish Lisp) which was heavily inspired by both Forth and Lisp. Very weird language but I always enjoyed programming those calculators.
The ancient HP41 and HP71 did have Forth interpreter ROMs available.
My best guess is it’s “a Forth” because you’re implementing a new language yourself, in the style of, but distinct from, the original Forth programming language. Is this correct?
Isn't Lisp just the same?
The TI-84+ series is such a specific technological niche that it makes sense to write a Forth customized for it platform, which the author of this OS did earlier. This repo is an OS though, so "Forth-based" means the OS is built on a Forth platform but with enough extra features that it is more than just a Forth language at this point.
Also, arguably, the part where it is compiled through Scheme might make the purists say it's not a true Forth (which tend to be self-hosting).
> Isn't Lisp just the same?
Most Common Lisp folks have hijacked the word "Lisp" to mean Common Lisp.
Then you have Lisp-1 and Lisp-2 definitions, so when you say "a Lisp" people will wonder which you fall into, and it'll be one of the first asked questions.
Depending on your audience, they may have a very fixed idea what "Lisp" means, and it may be a very detailed concept.
Forths don't tend to suffer from those problems.