3 ms·
Does the "metacircular" part just mean that the compiler can use definitions it's already compiled in the current pass?
by pmarreck 5y ago
Does the "metacircular" part just mean that the compiler can use definitions it's already compiled in the current pass?
- vanderZwan 5y agoNo, it more or less means that a language is described in (part of) the language itself. And before you ask, no, it's not quite the same as self-hosting (good question though). The latter is more associated with compilers that can take a source file and produce another compiler. The former is often more like an interpreter that provides support for part of a language, but those part are enough to define support for the rest of the language. So in this case, the base implementation starts with support for only a subset of the Forth language, picked for being either essential or much more performant when implemented "natively" in the binary. A subset of this subset is then used to construct support for the rest of the language. This is very typical for Forth- and Lisp-like languages. [0] https://en.wikipedia.org/wiki/Meta-circular_evaluator https://en.wikipedia.org/wiki/Meta-circular_evaluator [1] https://en.wikipedia.org/wiki/Self-hosting_(compilers) https://en.wikipedia.org/wiki/Self-hosting_(compilers)
- qgc 5y agoIt would be more accurate to describe a metacompiler as a cross compiler to the machine an interpreted Forth is implemented on. I recommend Moving Forth [1] for the full explanation. (That's the part that addresses metacompliers, the rest is still quite a great book.) [1] https://www.bradrodriguez.com/papers/moving4.htm https://www.bradrodriguez.com/papers/moving4.htm