diff --git a/runtime/Makefile b/runtime/Makefile index 0892928..84b048c 100644 --- a/runtime/Makefile +++ b/runtime/Makefile @@ -1,9 +1,9 @@ CC := g++ CFLAGS := -Wall CFLAGS += -std=c++11 -#CFLAGS += -fno-rtti -#CFLAGS += -fno-exceptions -#CFLAGS += -Os +CFLAGS += -fno-rtti +CFLAGS += -fno-exceptions +CFLAGS += -Os LFLAGS := .PHONY: all diff --git a/tester.cpp b/tester.cpp index dbb5f34..974a0b4 100644 --- a/tester.cpp +++ b/tester.cpp @@ -410,6 +410,58 @@ void testForLoop() logger("testForLoop cleared"); } +void testOnNCall() +{ + logger("testOnNCall entered"); + string s1 = string("func1"); + fn *f1=fn::declare(s1, T_UNKNOWNFUNC); + print=new printSegment(new expression(new constOp(string("one"), T_STRING))); + print->generate(); + delete print; + f1->close(); + logger("func1 declared"); + string s2=string("func2"); + fn *f2=fn::declare(s2, T_UNKNOWNFUNC); + print=new printSegment(new expression(new constOp(string("two"), T_STRING))); + print->generate(); + delete print; + f2->close(); + logger("func2 declared"); + string s3=string("func3"); + fn *f3=fn::declare(s3, T_UNKNOWNFUNC); + print=new printSegment(new expression(new constOp(string("three"), T_STRING))); + print->generate(); + delete print; + f3->close(); + logger("func3 declared"); + string s=string("countdown"); + variableType *q=variableType::getOrCreateVar(s, T_INTVAR); + logger("countdown var declared"); + forLoop *f=new forLoop(q, + new expression(new constOp("3",T_INT)), + new expression(new constOp("0",T_INT)), + new expression(new constOp("-1",T_INT)) + ); + logger("forloop declared"); + list