Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re: Making my own control flow structure

by traveler (Parson)
on Oct 09, 2006 at 22:06 UTC ( [id://577277] : note . print w/replies, xml ) Need Help??

in reply to Making my own control flow structure

Some (semi-) random thoughts that might help:
  • If you can limit your language to only contain functions as the bodies of ifs, things should be easier
  • You could use a source filter or perhaps the CPP to translate ifdo expr function(args) to something like if(expr){function(1,args)}else {function(0,args)} and then use one or more of the Aspect:: modules to strip out the first arg and print an appropriate message. Or you could put a print in the else if that would be alright.
  • If you want to see the unexecuted code you could use a source filter to store it away and then print it out instead of deparsing it. That way you get the actual code.
  • You could write a translater from scratch to translate your language into perl and then run the result :-)