4 ms·
Yes...and far more accurately no, you can't actually write a parser for Forth with a fixed grammar, you can only write a complete interpreter for it as it is ca
by howerj 8y ago
Yes...and far more accurately no, you can't actually write a parser for Forth with a fixed grammar, you can only write a complete interpreter for it as it is capable of modifying its own grammar on the fly. It is possible to define new words which when executed take over the input stream and do arbitrary things.
- kazinator 8y agoThose tricks will not necessarily compile right though. Forth is a compiled language, if implemented completely.
- howerj 8y agoThose tricks certainly are necessary to compile Forth, it's common to define words that create new words for custom data structure, which extend the grammar of Forth. Any time you use 'create ... does>' you are in effect extending the grammar in an ad-hoc way.