Php Transpiler (per to x)
I need to make a transpiler (want is probably a better word) to convert one language (one I create) to another language (a scripting language for a game (.per)).
Here's a simple example of the actual code -
Code:
(defrule
(wood-amount > 100)
(unit-type-count-total militia-line < 10)
(can-train militia-line)
=>
(train militia-line)
)
But in my one, it would look like this -
Code:
if(
wood.amount > 100;
militia-line.count() < 10;
can(train(militia-line));
){
train(militia-line);
}
How would you go about doing this?
P.s. I know this would be better in a different language, but it's more of a proof of concept...