4 ms·
One compelling use case is getting a REPL on any microcontroller with a UART and, say, ≥64K RAM (I remember lbForth[1] being particularly portable, and there ar
by mananaysiempre 2y ago
One compelling use case is getting a REPL on any microcontroller with a UART and, say, ≥64K RAM (I remember lbForth[1] being particularly portable, and there are other implementations you could use as well).
I don’t know if you’d want to have that be your first experience with the Forth itself, though: there’s inherent fiddliness involved in bringing up hardware; the win is that Forth doesn’t really add any of its own once you’re vaguely familliar with the internals. If you can get it to boot and send and receive bytes, you can get an interactive Forth on it—or if the available resources don’t permit that, on an imaginary machine spanning it and your PC (a “tethered” Forth).
[1] https://github.com/larsbrinkhoff/lbForth https://github.com/larsbrinkhoff/lbForth
- NonEUCitizen 2y agoI think you meant ≤ instead of ≥ 64K RAM
- mananaysiempre 2y agoI didn’t, no, but perhaps this merits a clarification. The native habitat of a traditional Forth is an 8-bit microcomputer, and compared to modern microcontrollers those had not a lot of compute but fairly abundant RAM (not to mention permanent rewritable storage). So to run a Forth organized along the usual lines, with a flat address space and a singular dictionary space and code loaded from textual blocks and so on, you do want 64K of RAM, I think. You could push that down to maybe 16K, with some limitations[1]. But on a modern 8-bitter with 2K or 4K, you are going to need a system that can compile things offline, and then you can flash the resulting image and do your interactive work within a small in-RAM layer on top of that. That’s absolutely a thing people do, but it’s not what Starting Forth, Thinking Forth, and various other sources about Forth describe. [1] E.g. the Apple II fig-Forth from https://www.forth.org/fig-forth/contents.html https://www.forth.org/fig-forth/contents.html requires the 48K RAM expansion and “provid[es] about 6K for user growth of the dictionary”.