removed parameter passing of globals and fixed expression evaluator some

This commit is contained in:
Samuel D. Crow
2021-03-13 16:49:58 -06:00
parent 43319754a8
commit 4b2b567a42
5 changed files with 532 additions and 476 deletions

31
yabFunctions.cpp Normal file
View File

@@ -0,0 +1,31 @@
/*
** Yab2Cpp
**
** Transpiler by Samuel D. Crow
**
** Based on Yab
**
*/
#include "yab2cpp.h"
/* function definitions */
fn *fn::getCurrentSub()
{
return callStack.back;
}
void fn::generateOnNSub(expression *e)
{
this->ret=new label();
fn::callStack.push_back(this);
label::generateOnNTo(e);
output_cpp << "case " << ret->getID() << ":\n";
}
void fn::generateGosub(shared_ptr<label> sub)
{
this->ret=new label();
fn::callStack.push_back(this);
output_cpp << "state=" << sub->getID() << ";\nbreak;\n";
output_cpp << "case " << ret->getID() << ":\n";
}