A while back I got the urge the waste time on yet another project. This time, it’s a version of Template Toolkit for .NET. As usual, you can find the project on GitHub.

Not knowing anything about what it takes to convert a template language to .NET I started from ground up learning how to use ANTLR to create a lexer/parser automatically from a grammar definition. As if that wasn’t enough, my parser output is an Abstract Syntax Tree, which I then use another grammar to template it into C# code using StringTemplate templates, which ANTLR supports natively.

It’s slow going, but I’m learning a lot along the way. At some point I’m going to output VB.NET and it still needs a lot of work for compilation, dll caching and such. The code is in a pre beta state, but it does support basic GET/SET/DEFAULT/IF statements and I’m slowly adding more as I get more comfortable with ANTLR.

See more posts about: All Categories