var engine = new Engine(SeedXLanguage.SeedPython, RunMode.Script);
string code = "a=0\nfor i in range(10):\n\ta = a + i\n\t";
var collection = new DiagnosticCollection();
if (!engine.Compile(code, "", collection)) {
Console.WriteLine(collection.Diagnostics[0].ToString());
} else {
Console.WriteLine("OK");
}
The above code results in SeedLang compilation error:
20220620002906110 Fatal (SeedLang.X) <> [Ln 4, Col 1 - Ln 4, Col 0] 29: SyntaxErrorMissingToken '<EOF>' DEDENT
While in Python3, the same code piece can be executed with no error:
Python 3.9.13 (main, May 24 2022, 21:13:51)
[Clang 13.1.6 (clang-1316.0.21.2)] on darwin
>>> code = "a=0\nfor i in range(10):\n\ta = a + i\n\t"
>>> exec(code)
>>> a
45
The above code results in SeedLang compilation error:
While in Python3, the same code piece can be executed with no error: