The long overdue PIL2 node redesign braindump + brainstorming Gobby session took place tonight, commissioned by fglock and participated by a record number of 7 lambdacamels.
The draft document really needs some tidying up, but it's a fairly complete picture of what I had in mind during the Tokyo hackathon.
Our design space was simplified enormously this time, thanks to two insights from Matz:
- All compile-time special forms should be reconstructable as run-time method calls
- The object space is itself an object, so precomposed objects at BEGIN{} time can be freely shuffled into runtime.
Ergo, even with separate compilation and BEGIN blocks, the AST can still be entirely dynamic and not contain any compile-time nodes. (Thanks also to ko1 for pointing me to Ruby 1.8.1 nodes.)
Also, because this tree is to be shared among three Perl 6 implementations -- none of which written entirely in Perl 6 yet (i.e. with significant Hs/Perl5/PIR parts), it is vitally important that all nodes can be translated back to Perl 6 surface syntax, and we have to forbid any backend-specific "optimization" nodes (e.g. pRawName in PIL1 for PIR codegen).
With this guarantee, the implementations can naturally converge into a self-hosting Perl 6 with maximal code sharing, instead of having subtle semantic differences.
The next step is to come up with a minimal surface form, suitable to embed inside rules, so we can manipulate the parse tree for Perl 6 with Perl 6, without requiring a fully self-hosting implementation. Then the most diverging part of the three implementations -- namely, parse tree construction -- can suffer less from the language barrier, and that would be a Good Thing. :-)
Audrey, thanks for all your new documentation posts!
Posted by: András Bártházi | 2006.04.18 at 03:06 AM