diff options
| Commit | 532a594a0efac2e7624e1c9ddce8fb6d81dace4f (patch) | |
|---|---|---|
| Author | 2018-11-14 09:33:50 +0200 | |
| Committer | 2018-11-15 11:43:12 +0200 | |
| Files | ff1783936eccb7e0c785503edbd0348ec2cc9016 /JSImpl/src/main.cpp | |
| IPL-532a594a0efac2e7624e1c9ddce8fb6d81dace4f.tar IPL-532a594a0efac2e7624e1c9ddce8fb6d81dace4f.tar.gz IPL-532a594a0efac2e7624e1c9ddce8fb6d81dace4f.zip | ||
| Parent | 60ff8830ed0d62820205420da2678cb3b410a66e (diff) | |
Implement if
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 |
