Go Forth
Cristina Videira Lopes · 2020
The syntax of Forth may be hard to understand due to its postfix nature and several special symbols that aren’t used in any other language. But the language model is surprisingly simple once we understand the constraints–the stack, the heap, procedures and names. Rather than using a Forth interpreter written in Python, this chapter shows how the constraints underlying Forth can be codified in Python programs, resulting, roughly, in a Forth style of programming. The frequencies procedure shows one more stylistic detail related to arithmetic operations. That procedure starts with the non-stop words on the stack and ends with placing a dictionary of word frequencies onto the stack.