in reply to Embedded perl or mini-language translator to perl
But suppose you don't buy this argument. I would look first to Template Toolkit and/or Mason for ideas on how to implement your little language and integrate it with HTML.
If those are not extendable to your needs, then a full parser is in your future. First, you will have to create a language and forge a grammar that has no pathologies and is unambiguous. P::RD is a good choice for the parser, as there are many example grammars out there to learn from. Another choice is to create your own top-down parser. Nonterninals are mapped to subs, terminals to regexes, and translation can either be done as you parse, or later walking the parse tree.
Whether you use P::RD or roll your own, you will want to learn how to create good grammars, handle variables and symbol tables and detect all manner of syntax errors. The best book I know of for these tasks is Compilers: Principles, Techniques and Tools, by Aho, Sethi and Ullman.
-Mark
|
---|