This code [it's good old straight C] or something in the likes of it should suffice for transforming spaceless arithmetic statements into spaced arithmetic statments (for the new GM) :
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
char out[2];
char outputString[1024];
void** reformatString(char theString[]);
char* makeValidString(int in);
void* outputPointer;
void** reformatString(char theString[]){
int currentChar = 0;
sprintf(outputString,"");
while(currentChar<strlen(theString)){
if(strcmp(makeValidString(theString[currentChar]),"=")==0
|| strcmp(makeValidString(theString[currentChar]),"+")==0
|| strcmp(makeValidString(theString[currentChar]),"*")==0
|| strcmp(makeValidString(theString[currentChar]),"/")==0){
sprintf(outputString,"%s %c ", outputString,theString[currentChar]);
} else {
sprintf(outputString,"%s%c", outputString,theString[currentChar]);
}
currentChar++;
}
outputPointer=&outputString;
return outputPointer;
}
char* makeValidString(int in){
sprintf(out,"%c", in);
outputPointer=&out;
return outputPointer;
}
For example,
reformatString("X=5") returns 'X = 5'
reformatString("A=B+C") returns 'A = B + C'
It should work with any kind of statement as the main operators are +, -, =, *, /
[EDIT] Corrected pointer error
[EDIT] Made code smaller, corrected pointer warnings