2 ms·
Sure it is. A traditional interpreter executes via generate-synthetic-code-and-emulate-cpu technique. This other method uses the native compiler to generate co
by JoeAltmaier 11y ago
Sure it is. A traditional interpreter executes via generate-synthetic-code-and-emulate-cpu technique. This other method uses the native compiler to generate code (i.e. compiles the 'Execute' methods).
- detaro 11y agoOk, now I get what you mean. I was a bit confused, because it sounded like simply building an AST and processing that, which for me is the "obvious" form of an interpreter (without the generating machine code)
- JoeAltmaier 11y agoAnother interpreter scheme: create a token form of the source, then pass over that constantly reinterpreting the tokens (re-parsing from tokens) and with massive switch() statements execute from a symbol table. That's the slowest, and how interpreters were done years ago.
- blt 11y agoIt sounds like you are describing either a JIT compiler or a direct AST interpreter. JIT compilers are indeed fast, but AST interpreters are usually slower than bytecode interpreters.