Second release, and I now have everything I need for doing basic file construction in Padre.
I've got whitespace control in tags via explicit chomping such as [%- foo -%].
The basic recursive expression resolver is done for things like [% hashkey.1.methodname %] and works for arrays, hashes and objects. The resolver also now has the same kind of exception-tolerant, warning-squashing behaviour that Template Toolkit does.
And finally I've added the three simplest and most basic control structures, IF, ELSE and UNLESS.
All this cost about an extra 15-20k of RAM, for around 40kb total so far (with maybe 5-10kb of recoverable fat). But note that I don't yet have support for files, so there's some fairly chunky costs still to come (especially because I can't use things like File::Spec).
Now this is where things get a little more interesting, because the real skill in creating most
For Template::Tiny, the key compromise looks to be stash immutability. If you can be sure that the stash will never mutate (and if you don't allow things to collide with the stash names) you no longer need to process the template elements in order from top to bottom. Which means you don't need to compile the template into intermediate Perl code, the templates won't be turing complete, and you can just evaluate it directly from template to finished text via a series of regex passes.
Of course, now I have some other problems, such as doing a fairly complex and recursive regex matching exercise using only features available in Perl 5.005 (and in very little code, and without resorting to things like Text::Balanced that are 1000 lines of code).
So if you have some serious regex-fu, I'd love some help because my other option is trawling around in Text::Balanced-type Damiancode for clues