in reply to perl as a compiler

It is possible to turn a perl script into c code using B::CC or into Jasmin assembler with B::JVM::Jasmin. However I doubt these are what you are looking for. You will probably end up in a situation where you will use a module like Parse::RecDescent to analyse each line in turn and output preformatted assembler. This is likely to be quite a task.

Another idea to follow would be to turn the whole thing on it's head and do a perl program that does the same as the game does. Accepts 'bots' (blocks of perl code) and evals them. I have worked on something a little like this while at university (which, unfortunately ate my code) while looking at ways of making MUD monsters AI more I and less A. It actually worked quite well.

$japh->{'Caillte'} = $me;

Replies are listed 'Best First'.
Re: Re: perl as a compiler
by tonyday (Scribe) on Mar 15, 2001 at 09:30 UTC
    Thanks for the idea. I was thinking of automating the process along similar lines - take perl code, eval it by spitting out the assembler routine and running the game. But I sense that you're taking the idea a few steps further.

    now if only I had listened in Compiler 101 class I could begin to comprehend what Parse:RecDescent is on about.

    tonyday