TT.NET: What could go wrong. :-)

jk2addict on 2009-05-07T01:17:15

I have this habit of getting off task with what ever new idea tickles my focus. I am tangental yak shaver of the ooh-shiny variety.

So, I'm working on MVC Marathon, a site called BurningPlate, coding ASP.NET MVC in C#. When it comes time to saddle up and write some views and tests, I wonder what ViewEngines there are. I see on for NHaml and StringTemplate.

Then I wonder what if would take to get Template Toolkit templates under .NET.

One ANTLR Reference book and a few days later, and I'm screwing around with grammers, lexers, parsers and AST.

What a learning session this is going to be, but if I get far enough, it will change the boundaries of what tools I have in my toolbox.


Re: TT.NET: What could go wrong. :-)

davorg on 2009-05-07T08:10:28

Back in 2005 I jotted down some random thoughts about how it would be a good idea if templating languages weren't so closely coupled with the architecture of the rest of the system. I was thinking of a situation where a "Template Toolkit programmer" could use TT to build the front end components of systems whether they were written in Perl, Ruby, Python or any other language.

Of course, real life intervened and I never did anything about it.

Re: TT.NET: What could go wrong. :-)

jk2addict on 2009-05-07T12:59:05

It sure would be easier if most languages shipped their grammer. TT has lex/yapp I believe, but I'm an ANTLR man, and a newb, so I'm sol either way at the moment. :-)

If it were just templating, it would be a tad easier. When templates embed another language, it's even worse.

Baby steps. Last night I made a first pass through the ANTR Ref book and at least have a working grammar/lexer/parser/tree for GET/SET expressions.

Oddly enough, the harder part seems to be splitting the passes to separate code from content, then doing the language expressions.

Unit Tests++++

Re: TT.NET: What could go wrong. :-)

mpeters on 2009-05-07T16:38:45

There is some prior work already for this: