To transform an interpreter to a compiler,
- Rewrite interpreter in CPS form.
- Identify Compile time and Runtime actions(CPAs and RTAs)
- Abstract RTAs into separate 'action procedures'.Use thunks to wrap any weird control structures where necessary
- Abstract Continuation Building procedures (CBPs)
- Convert RTAs and CBPs into records. Now the eval on the parse tree spits out a datastructure.
- Write an evaluator for the resulting data structure making sure to (a) implement register spilling (b) 'flatten' code to generate "assembly like" code.
- TODO : investigate the pros and cons of Bottom Up Rewriting Systems (BURS) vs the scheme above vs generating a (gcc) RTL like intermediate language
- TODO : investigate the effects on stack discipline and garbage collection when the various schemes are adopted . Which is more convenient?
No comments:
Post a Comment