Re:Show HN: Writing my first interpreter in C for fun
by sklogic on Wednesday June 22, 2016 @05:15AM
(#11952449)
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.
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.