twiggy your ::twig machine should have one method that takes one argument and that argument should be an xml string. the twig machine can parse instructions from the argument and move from there. the beauty of xml, xml schemas, xslt etc. is that they are essentially xml. your function calls are nasty looking to me, but xml looks friendly. wouldn't it be "nice" to simply pass xml to your ::twig machine. there is a need for that type of engine; just lose the nasy syntax.