Original text(via Lobsters)
Writing a primitive Forth in JavaScript
Contents
- Introduction What is Forth ? Motivation Resources Prototype
- What is Forth ?
- Proto Forth breakdown Data structures Word search Word call Word parse Interpreter (entry point) Word evaluation (forth core logic)
- Data structures
- Interpreter (entry point)
- Word evaluation (forth core logic)
- Postfix notation
Introduction
What is Forth ?
Motivation

Resources
- Forth Tutorial
- Forth Primitives
- StackFlow Forth
- Forth History
- The Language That Writes Itself
- XXIIVV page about Forth
Prototype

- : switch to compile mode
- ; switch to interpreter mode
- + add two numbers
- - subtract two numbers
- . show stack top content
- words show defined words
Proto Forth breakdown
Data structures
- a data stack to pass data between words, my prototype has a single data type : numbers
- a words dictionary which is where predefined words (also called primitives) go into along with user defined words
Word search
Word call
Word parse
Interpreter (entry point)
Word evaluation (forth core logic)

Postfix notation
Conclusion
