Petit Computer DSi SmileBASIC to be specific, basically it's a modified version of BASIC and it's one of the easiest programming languages you will ever use. It's running pretty dang slow. It's actually slower than Petit Computer DSi, and that's saying something, how the DS's little weak CPU is outdoing my i7 4790k. I thought an interpreter would be fast enough but it's becoming clear that it's not even sufficient to run games that utilized all of PTC's power. So as an example here's part of the code that handles IF THEN NEXT.
Probably extremely confusing out of context, but you get it, all that garbage is going to be multitudes slower than if () {} else {}. So I want to take the approach of not interpreting it by taking
IF VAR == 5 THEN PRINT "Var equals 5" ELSE PRINT "Var does not equal 5"
and turning it into
if (VAR==5) { print("Var equals 5"); } else { print("Var does not equal 5"); }
doing that for every found command, writing it all down into some kind of text file and then compiling that file, then running it. The problem is I'm fairly new to c++, (this is actually the first thing I've made since I figured out how to write and read text files) and I do not know how to do that.
I found this
http://runtimecompiledcplusplus.blogspot.com/
But it gives no explanation on how to use it.
Here's my program btw to anyone that wanted to look at it, no source code, I figure it's not really worth figuring out git just yet.
http://smilebasicsource.com/forum?ftid=466&page=1
Code:
case 143: //IF (143 is the index of "IF", using a switch because I thought it would be faster than multiple if statements. It's really not that much faster.)
if (solve(SBarr[line + ++addline])){
//if the requirement is met
addline += 1;
if (SBarr[line + addline + 1][0] == '@'){
setline = Variable.FindVal(SBarr[line + addline + 1]);
if (setline == 0){ synerr = 1; ret = 3; }
addline = 0;
}
synerr = 0;
}
else
{//get to the end of the statement (or the ELSE)
int lineo = SBarrLine[line + addline];
while (lineo == SBarrLine[line + addline] && SBarr[line + addline] != "ELSE"){
addline++;
}
if (SBarr[line + addline] != "ELSE"){ addline--; }
else{
if (SBarr[line + addline + 1][0] == '@'){
setline = Variable.FindVal(SBarr[line + addline + 1]); synerr = 0;
if (setline == 0){ synerr = 1; ret = 3; }
addline = 0;
}
}
synerr = 0;
}
break;Probably extremely confusing out of context, but you get it, all that garbage is going to be multitudes slower than if () {} else {}. So I want to take the approach of not interpreting it by taking
IF VAR == 5 THEN PRINT "Var equals 5" ELSE PRINT "Var does not equal 5"
and turning it into
if (VAR==5) { print("Var equals 5"); } else { print("Var does not equal 5"); }
doing that for every found command, writing it all down into some kind of text file and then compiling that file, then running it. The problem is I'm fairly new to c++, (this is actually the first thing I've made since I figured out how to write and read text files) and I do not know how to do that.
I found this
http://runtimecompiledcplusplus.blogspot.com/
But it gives no explanation on how to use it.
Here's my program btw to anyone that wanted to look at it, no source code, I figure it's not really worth figuring out git just yet.
http://smilebasicsource.com/forum?ftid=466&page=1
