Website Summary Files Commits Branches @commit @diff @stats
path: root / JSImpl / src / main.cpp
diff options
context:
space:
mode:
Commit6ba49b30cf1e33fb0dd6782a404ec34b7964cb59 (patch)
Author
 Martin Dobrev <martindobrev0@gmail.com>
2020-11-24 18:06:26 +0200
Committer
 GitHub <noreply@github.com>
2020-11-24 18:06:26 +0200
Filesa89b314c4d0b942d2350b9adbd741d6fa3375bfb /JSImpl/src/main.cpp
IPL-6ba49b30cf1e33fb0dd6782a404ec34b7964cb59.tar
IPL-6ba49b30cf1e33fb0dd6782a404ec34b7964cb59.tar.gz
IPL-6ba49b30cf1e33fb0dd6782a404ec34b7964cb59.zip
Parent4e883334a14ff22f12765204d6bf223d07c0298f (diff)
Feature/object getters (#101)
* Add member access expression. * Implement property getters. * Add test for property getters. * Add test for property setter. * Implement while and do-while Signed-off-by: Martin Dobrev <martindobrev0@gmail.com> * Add implement byte code generation for break/continue in for/while.
1 files changed, 12 insertions, 8 deletions
-rw-r--r--JSImpl/src/main.cpp20
diff --git a/JSImpl/src/main.cpp b/JSImpl/src/main.cpp
index 06421a7..aee465d 100644
--- a/JSImpl/src/main.cpp
+++ b/JSImpl/src/main.cpp
@@ -76,15 +76,16 @@ void Generate()
{
//Tokenize("var a = 0; var b = a + 123;a+b;", tokens);
/*Tokenize("var a; if(a < 4) { a = 8; if(a < 7) {var b = 4;}} else { a = 2} ", tokens);*/
- IPLString source = "var i = 0; \n"
- "for (var j = 0; j < 10; j++)\n"
- "{\n"
- " i = i + j;\n"
- "}";
+ //IPLString source = "var i = 0; \n"
+ // "for (var j = 0; j < 10; j++)\n"
+ // "{\n"
+ // " i = i + j;\n"
+ // "}";
+ IPLString source = "var a = 5; do{ a--; if(a == 4) continue; }while(a != 0)\n";
auto tokens = Tokenize(source.c_str()).tokens;
auto asmb = GenerateByteCode(Parse(tokens), source,
- ByteCodeGeneratorOptions(ByteCodeGeneratorOptions::OptimizationsType::None, true));
+ ByteCodeGeneratorOptions(ByteCodeGeneratorOptions::OptimizationsType::None, false));
//sets the color to intense red on blue background
#if defined(_WIN32)
@@ -231,13 +232,16 @@ private:
int main(int argc, char* argv[])
{
+ (void)argv;
+ (void)argc;
// You can try =>
// Working dir: $(ProjectDir)
// Command arguments: --input ./../examples/code.js --output ./../examples/some.ast --ast
- CammandLineApp cmd;
- cmd.RunAsCommandLine(argc, argv);
+ //CammandLineApp cmd;
+ //cmd.RunAsCommandLine(argc, argv);
//auto r = Tokenize("a#4", {true ,true});
//RunParseCalc();
+ Generate();
#if defined(_WIN32)
//std::system("pause");
#endif