Theory of interpreters, partial evaluators, and compilers

274 views Asked by At

So I've been learning about stack machines, interpreters, compilers and a few other things related to programming languages and their general theory. Most of the stuff I find in books and online are very specialized and talk about one specific topic, e.g. interpreters, with no mention of how it relates to other topics, e.g. partial evaluators. Are there any good beginner resources for exploring the interconnections between interpreters, compilers, and partial evaluators? By good resources I mean something that explains the theory along with concrete implementations. The more I learn about this stuff the more places I see in my day to day work of how all of it can be applied but the lack of beginner friendly resources is a bit of bummer.

1

There are 1 answers

0
box On BEST ANSWER

one project which uses both interpreters, compiler, and partial evaluators is Truffle with Graal. you implement an AST interpreter in the Java Truffle framework and the JIT compiler Graal compiles it. the special thing about it is, that the Truffle language implementation should specialize to a subset of the actual semantics that correspond to the current execution. Graal only produces machine code for this specialized subset and deoptimizes, if previous execution assumptions are invalidated. the framework also inlines through all the AST execution methods, which is then a form of partial evaluation. you can find several papers online or directly have a look at the code.