Come for the quick hacks, stay for the epiphanies. | |
PerlMonks |
Re^3: Intermixed perl?by jbert (Priest) |
on Nov 09, 2007 at 18:17 UTC ( [id://649967]=note: print w/replies, xml ) | Need Help?? |
No, you're right. But I don't see how the problem as posed makes sense since he wants to add syntactic constructs (e.g. close brace }) at runtime (i.e. post-parse).
So I'd guess I'd solve his specific problem by adding some plugin capability to his interpreters, so I could do something like MYEMPLOYER_APP_PLUGINS=Foo,Bar and then the Foo and Bar plugins get called at various stages of command and argument processing. This would require defining an API for the plugins in terms of what they could inspect and what they could change. So this is work. And hence sucks, and this is why little languages (DSLs) suck unless they are embedded within a more powerful general purpose language (so you can escape to the big language when you need to). Otherwise you find yourself re-inventing loops, conditionals, I/O etc in your little language over time. So I guess really I'd write a converter to make all of these cmd files become perl and then just embed perl. It could be fairly mechanical (he already has the parsers): and then pre-load a per-interpreter module which provides functions (command1 etc) which must also already exist.
In Section
Seekers of Perl Wisdom
|
|