GSoC 11: Breaking Radio Silence

*tap, tap, tap* Is this thing on? It is? Drat, I had hoped it wasn't and I'd have something to blame for the long silence.

Due to the issues I'm about to describe, my old schedule is a little off. The important schedule note is that the official "pencils down" date is August 15th, aka next week. Current plan is to power through as much as I can in the next few days. At this point, I doubt that my branch will be merged into master before the end of GSoC, but I do intend to keep working on it.

The core of my problem is in this line from my last blog post:

Whenever I hit an issue, I'll go in and fix PAST::Compiler to ensure it generates a newPOST tree that works for both PIR and PBC generation.

Here's the problem: oldPOST and newPOST just don't work the same way. I lost at least a week at trying to figure out how to generate the right PIR from newPOST trees. Flat out: newPOST is designed to be close to the bytecode, while oldPOST is designed to generate PIR. And since it's just working with PIR, a lot of tricks can be done and it can store a lot of information as text.

Finally, whiteknight++ suggested that I create a parallel system instead of trying to make it work both ways. So today, PCT::HLLCompiler (on my branch) has two new stages:

  • newpost - takes a PAST tree and returns a newPOST tree suitable for bytecode compilation.
  • pbc - takes a newPOST tree, generates PBC, returns the main sub from it

These are front ends to the PAST::NewCompiler and POST::PBCCompiler classes. The simpler one for me to write was the latter, which simply consists of all of the functions from POST::Compiler that had to do with pbc generation. Separating them out was mostly about ensuring they one didn't rely on the other. The new PAST compiler is a subclass of PAST::Compiler that intercepts function calls and makes whatever changes to the tree are required for newPOST to work properly.

These are supported by two tests in t/compilers/pct: newpost.t and newpast.t. newpost.t is mostly about ensuring that I know how to generate functional newPOST trees. newpast.t is about testing that PAST trees compile properly.

My current goal is to get t/compilers/pct/complete_workflow.t to run both the old and new generation methods as a proof of concept. I'm trying to keep the changes to oldPOST as minimal as possible. The tweaks in PAST::NewCompiler can be merged with PAST::Compiler once we know what they are.