Continuation Passing Style

My iPhone project will grab all of my time for the next two to three weeks before I can continue with my Android/Babel-17 project. Once the iPhone project is done, Babel-17 will be back with a vengeance! The plan is to introduce a new intermediate representation CPS for Babel-17 programs. CPS stands for “continuation-passing style” and there will be a translator from the current representation (lets call it B17) to CPS. This translator handles features of Babel-17 like pattern matching, linear scope, tail recursion.

The advantage of the CPS representation is that it is much closer to the metal than B17. Therefore CPS is the ideal starting point for different code generator backends. Code generators for Java, Javascript, LLVM etc. just need to understand CPS as their input. It will therefore be easy to let Babel-17 target a new platform, as the substantial work of parsing a Babel-17 program into a B17 representation, checking a program in B17 form and translating a B17 program into a CPS program will have already been done.

Leave a comment