if the problem with creating a m-file compiler is that a variable can change type during its lifetime in octave and that this creates non compileable code I have a new idea.
As I wrote earlier a simple solution could be to change the name of the variable when it changes type, it can be done i different ways but a counter and adding a suffix is a simple way.
The new idea is that you don't need to change your interpreter, it is probably a complicated thing and adding my name changing concept to it could be a hard thing to do. But you can just add my idea to the interpreted code. So first you create a non compileable string with your interpreter, and then subject it to my idea:
//non compileable code made with your interpreter
// use A as int
// use A as double
add suffix to A, counter, make a class that represents every variable etc etc , there are many ways to solve this, and change the code to:
//compileable code made with function that adds suffix to every variable
// use A_0 as int
double A_1=1.3; //A changes value, rename, counter counts up and adds suffix
// use A_1 as double
I don't want to get involved with your interpreter but if you just create a function that creates non compileable code I could possibly make it compilable with this technique. I will give the code to you in java and you can translate it to C which I think you work in. No money. The performance leap could be huge. Kind regards.