Re:Forth: The Hacker’s Language (2017)
by anadem on Tuesday September 03, 2019 @01:01PM
(#20868605)
The first paid programming contract I got, back in the late 70s, was writing a records management system for a water company .. we wrote the Forth interpreter too, for a 6502 CPU, to get low-level access to hardware such as water level sensors. A major obstacle was getting British Telecoms' permission to send data over the POTS line, but it all worked well for years. I love Forth.
[ Parent
| on HN ]
Re:Forth: The Hacker’s Language (2017)
by 6thaccount2 on Tuesday September 03, 2019 @01:31PM
(#20868903)
I really wish there was a modern book on implementing a useful Forth for x86 or Raspberry PI out of C. Not just a pamphlet either, but a thick book covering how to choose between all the different threading options...etc.
Re:Forth: The Hacker’s Language (2017)
by microtherion on Tuesday September 03, 2019 @02:33PM
(#20869629)
I don't know about "modern", but you could go the traditional route and bootstrap it from Assembler (You'll find that you only have to implement a tiny number of primitives until you can start implementing the rest in Forth itself).
Chapter 9 of Leo Brodie's "Starting Forth" is the text that kicked off my implementation in the early 80s (and undoubtedly countless others): https://www.forth.com/starting-forth/9-forth-execution/
Re:Forth: The Hacker’s Language (2017)
by 6thaccount2 on Tuesday September 03, 2019 @02:51PM
(#20869831)
Does Brodie's book cover implementation though? I can code in Forth a bit already, but want to know more about implementing in a low level language.
Re:Forth: The Hacker’s Language (2017)
by bdowling on Tuesday September 03, 2019 @05:06PM
(#20871170)
> want to know more about implementing in a low level language.
You might check out Jonesforth [0], which is an extensively-documented Forth implemented in x86 assembly language. If you read the single source file top to bottom, you'll get a good understanding of how it is implemented. There are also ports to x86-64, ARM, and other machines.
If you're looking for something in C, you might check out Ficl. [1]
[0] https://github.com/nornagon/jonesforth/blob/master/jonesfort... [1] http://ficl.sourceforge.net
Re:Forth: The Hacker’s Language (2017)
by 6thaccount2 on Tuesday September 03, 2019 @07:25PM
(#20872398)
I always forget about Jonesforth. Glad to see it's on GitHub now!
Re:Forth: The Hacker’s Language (2017)
by bdowling on Tuesday September 03, 2019 @08:35PM
(#20872839)
> Glad to see it's on GitHub now!
Ah, that github link is not the official repository. The following link appears to be the official repo:
Re:Forth: The Hacker’s Language (2017)
by microtherion on Tuesday September 03, 2019 @03:23PM
(#20870173)
This particular chapter talks about implementation. It probably gets you 80%-90% to an understanding of what you need to do, and the rest should be learnable by examining other implementations, now that you know what to look for.