diff options
1 files changed, 12 insertions, 2 deletions
| -rw-r--r-- | JSImpl/src/main.cpp | 14 |
diff --git a/JSImpl/src/main.cpp b/JSImpl/src/main.cpp index a10e4d1..b2fb83d 100644 --- a/JSImpl/src/main.cpp +++ b/JSImpl/src/main.cpp @@ -2,6 +2,7 @@ #include "Parser.h" #include "ASTPrinter.h" #include "ASTInterpreter.h" +#include "ByteCodeGenerator.h" #include <iostream> #include <cstring> @@ -62,11 +63,20 @@ void InteractiveInterpreter() } while (true); } +void Generate() +{ + IPLVector<Token> tokens; + //Tokenize("var a = 0; var b = a + 123;a+b;", tokens); + Tokenize("var a; if(a < 4) { a = 8;} else { a = 2} ", tokens); + + std::cout << GenerateByteCode(Parse(tokens)); +} + int main() { //RunParseCalc(); - InteractiveInterpreter(); - + //InteractiveInterpreter(); + Generate(); #if defined(_WIN32) std::system("pause"); #endif |
