Fort is the most obvious thing I can think of. It is concatenative and stack-based, with the word being the main atom. Thus, you write a stream of words, and they are executed in the order in which they are written when the stack is manipulated explicitly to pass parameters, results, etc. So a simple Forth program might look like this:
6 3 + .
These are the words 6 , 3 , + and . . Two numbers push their values โโonto the stack. The plus symbol pushes the last two elements from the stack, adds them and pushes the result. A full stop displays everything at the top of the stack.
The fundamental part of the Fort is that you define your own words. Since all words are first-class members of the runtime, you are actually creating application-specific grammar. Having defined the corresponding words, you can get the code:
red circle draw
To expand the red circle.
The fort interprets every sequence of words when it encounters them. However, he distinguishes between compilation time and ordinary words. Compilation words do things like a sequence of words compiled and stored as a new word. Thus, the equivalent of defining routines in the classical procedural language. They are also a means of implementing governance structures. But you can also define your own compilation words.
As a final result, the Forth program usually determines its entire grammar, including the corresponding control words.
You can read the basic introduction here .
Tommy source share