Archive for 2nd May 2007

Microsoft.Scripting: Someone’s Going to Have to Target This With Antlr

The source code to the Microsoft.Scripting namespace is available at http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=438

A review of the IronPython codebase in the release makes the early-stage processing look pretty close to the (well-designed) IronPython 1.0 release: there’s a language-specific tokenizer, parser, AST generator and walker. Once you’ve transformed your AST into whatever-the-appropriate-form is, code generation looks insanely easy.

So the bad news is that there’s no compiler = new Language(BNF myGrammar); statement. The good news is that we already have such things: they’re called Lex and Yacc — or better yet, ANTLR. Although the sheer line-count of a language-specific compiler using Microsoft.Scripting seems large, such tools should be able to generate maybe 80-90% of it (I’m talking of the compiler, not the shell or runtime support, but that, too, looks generically handled by Microsoft.Scripting).

But this is one of those recursive things — you can’t generate a DLR-based compiler until someone writes a DLR target for the compiler-compiler. Interestingly, the definitive ANTLR Book will hit the shelves any day now. Hmmm … if I was a kid interested in getting a job at Microsoft, I know what I’d be doing this Summer …

Dynamic Language Runtime: PHP, Scheme, and "maybe one more" coming

The preliminary documentation for the DLR is included in the IronPython-2.0A1-Doc.zip download at http://www.codeplex.com/IronPython/Release/ProjectReleases.aspx?ReleaseId=438 :

We’re leveraging the learning we did on IronPython to extract elements that could be common amongst languages (dynamic type system, hosting APIs, cached method dispatch, symbol tables, ASTs, codegen, etc.), and we currently are working on IronPython 2.0, JScript, VBX, and Ruby to vet the common designs. We’ll eventually do (or recruit people to do) PHP, scheme, and maybe one more to believe we really can move language+1 with ease to the DLR.

…. Another juicy quote …

That runtime needs a great scripting story and UIFx story to compete with the virtuous cycle Flash/EcmaScript enjoy. We also watn to work with a partner on an IDE to eventually make a play for the MS app programmability story so that you can have your choice of dynamic language on a little runtime for scripting, say, Office or VS.