fixes scope bug in test code, typo in runtime and makefiles

This commit is contained in:
Samuel D. Crow
2021-03-25 14:38:17 -05:00
parent 48505d1ef8
commit fd89b1a054
4 changed files with 22 additions and 9 deletions

View File

@@ -1,6 +1,8 @@
CC := g++
CFLAGS := -Wall
CFLAGS += -std=c++11
CFLAGS += -fno-rtti
CFLAGS += -fno-exceptions
CFLAGS += -Os
LFLAGS :=

View File

@@ -1,6 +1,8 @@
CC := g++
CFLAGS := -Wall
CFLAGS += -std=c++11
CFLAGS += -fno-rtti
CFLAGS += -fno-exceptions
CFLAGS += -Os
LFLAGS :=
@@ -18,11 +20,11 @@ bin_main: $(MAIN_OBJ_DEPS)
$(CC) -o main $(MAIN_OBJ_DEPS)
main.o: $(OUTPUT_DEPS)
$(CC) -o main.o -c main.cpp
$(CC) $(CFLAGS) -o main.o -c main.cpp
output.o: $(OUTPUT_DEPS)
$(CC) -I$(SRC) -o output.o -c $(SRC)output.cpp
$(CC) $(CFLAGS) -I$(SRC) -o output.o -c $(SRC)output.cpp
.PHONY: clean
clean:
rm -rf *.o main
rm -rf *.o main

View File

@@ -4,8 +4,9 @@
** by Samuel D. Crow
*/
#ifndef YAB_RUNTIME
#define YAB_RUTTIME
#define YAB_RUNTIME
#include <string>
#include <cstdio>
using namespace std;

View File

@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
helpText(argv[0]);
break;
}
cout << "vamanos!" <<endl;
cout << "program exiting" <<endl;
return 0;
}
@@ -262,17 +262,25 @@ void shutDown()
{
output_cpp << "default:\nstate=UNDEFINED_STATE_ERROR;\n"
<< "break;\n}\n}\nreturn state;\n}"<< endl;
funcs_h.flush();
consts_h.flush();
heap_h.flush();
}
globals.clear();
locals.clear();
statics.clear();
}
shared_ptr<string>name;
shared_ptr<variableType>v;
shared_ptr<printSegment>print;
void testInt()
{
string name="v";
shared_ptr<variableType>v=
variableType::getOrCreateVar(name, T_INTVAR);
name=shared_ptr<string>(new string("v"));
v=variableType::getOrCreateVar(*name, T_INTVAR);
v->assignment(shared_ptr<expression>(new expression(
shared_ptr<operands>(new constOp("2", T_INT)))));
shared_ptr<printSegment>print=shared_ptr<printSegment>(
print=shared_ptr<printSegment>(
new printSegment(shared_ptr<expression>(new expression(v))));
print->generate();
label::generateEnd();