Fiddled with the .toy file

This commit is contained in:
2022-08-11 12:05:04 +01:00
parent 52651c5f2c
commit 32ac46d9a0
2 changed files with 12 additions and 4 deletions

View File

@@ -4,6 +4,7 @@
multi line comment multi line comment
*/ */
//test primitive literals
print "hello world"; print "hello world";
print null; print null;
print true; print true;
@@ -23,7 +24,7 @@ print 2 + (3 * 3);
} }
print "Back to the outer scope."; print "Back to the outer scope.";
//test compounds
print [1, 2, 3]; print [1, 2, 3];
print [4, 5]; print [4, 5];
print ["key":"value"]; print ["key":"value"];
@@ -31,16 +32,23 @@ print [1, 2, 3];
print [4, 5]; print [4, 5];
print ["key":"value"]; print ["key":"value"];
//empties //test empties
print []; print [];
print [:]; print [:];
//recursive //test nested compounds
print [[1, 2, 3], [4, 5, 6], [7, 8, 9]]; print [[1, 2, 3], [4, 5, 6], [7, 8, 9]];
//not ready yet
//var x = 31;
//var y : int = 42;
//var arr : [int] = [1, 2, 3, 42]; //var arr : [int] = [1, 2, 3, 42];
//var dict : [string, int] = ["hello": 1, "world":2]; //var dict : [string, int] = ["hello": 1, "world":2];
//print x;
//print x + y;
//print arr;
//print dict;
//test asserts at the end of the file //test asserts at the end of the file
assert true, "This won't be seen"; assert true, "This won't be seen";

View File

@@ -574,7 +574,7 @@ static bool calcStaticBinaryArithmetic(Node** nodeHandle) {
return true; return true;
} }
//optimize by converting this node into a literal //optimize by converting this node into a literal node
freeNode((*nodeHandle)->binary.left); freeNode((*nodeHandle)->binary.left);
freeNode((*nodeHandle)->binary.right); freeNode((*nodeHandle)->binary.right);