3 ms·
Compilers are in general far simpler than interpreters, especially if you're trying to build an interpreter with a reasonable performance. For a simple languag
by sklogic 10y ago
Compilers are in general far simpler than interpreters, especially if you're trying to build an interpreter with a reasonable performance.
For a simple language compiler is nothing more than a chain "parse -> strip off syntax sugar -> resolve lexical scope -> propagate types -> flatten the code -> emit target code", with each step being independent and trivial, nothing more than a set of tree rewrite rules.