ToyScript and the DLR : 3 Different Compilers

While I talked about being blown away by certain talks at Lang.NET, from a pragmatic standpoint I very much enjoyed the practical talks, such as those given by Harry Pierson and, especially, Martin Maly. Martin is one of the IronPython / DLR developers and hand-wrote a compiler for a language called “ToyScript.” This compiler is now part of the IronPython distribution. Harry wrote an F# PEG parser (is that redundant?) of ToyScript and I wrote an ANTLR-based parser. The hope is to show 3 different approaches to building the compiler front-end, but all using the same backend (“Hand off the AST to the DLR”).

Now, on the way to that, I started yesterday writing a series of examples that do things exactly backward: start with the handoff to the DLR (“GenerateNopFunction()“), add nodes (Using XML to represent the AST), and then say “Oh, and you create that AST using compiler front-end techniques.” The sad thing is that all of this will have to be in my copious spare time, since my language stuff isn’t supported by paying articles (I did the Lang.NET conference on my own dime).