[stringtemplate-interest] StringTemplate Compiler for .NET

Volkan Ceylan volkanceylan at gmail.com
Fri Mar 20 00:33:03 PDT 2009


2009/3/20 Sam Harwell <sharwell at pixelminegames.com>:
> I checked in (CL5952) an update that builds a delegate (System.Func<T>)
> inside ActionEvaluator instead of basic interpretation. I have not
> implemented caching of the delegates or optimized resolution of
> arguments other special name attributes. However, the implementation is
> a complete working example of execution of a compiled template that
> passes the same 1200 unit tests that the interpreter does.

Great, you are so fast, i hope i'll be able to see your work one day,
if Prof. Parr lets me :)

>
> If optimizations including but not limited to known formal arguments
> being resolved to a predetermined index when the functors are assembled,
> this code could be a true beast. :)
Yes, i forgot to mention that i also keep list of known arguments in
an argument array and access them by their predetermined index
directly.

>
> In my test cases of using StringTemplate to generate code, I found that
> a small percentage of calls to GetAttribute contained a special name
> like "it". Almost all were names of formal arguments.

I meant the sole argument of the template by "it", where for example
in template "$items:{x|$<b>x</b>$}$", here "x", the sole argument is
"it". There is no need for an argument array if template only has one
attribute. Yes, usually people don't use "it" as the default sole
argument name anymore.


More information about the stringtemplate-interest mailing list