now variables can access the global scope

This commit is contained in:
Francesco Cozzuto
2021-11-30 23:34:16 +01:00
parent c6387154b0
commit cbb8ac4337
7 changed files with 72 additions and 52 deletions
+24
View File
@@ -0,0 +1,24 @@
depth = 9;
fun fail(p)
{
if p < depth:
fail(p+1, depth, fail);
else
assert(false);
}
#fail(0);
fun a()
{
fun b()
{
print(depth, '\n');
}
b();
}
a();
-12
View File
@@ -1,17 +1,5 @@
l = [1, 2, 3, 4];
print('The list contains ', count(l), ' items.\n');
print('The list is: ', l, '.\n');
fun fail(p, fail)
{
if p == 5:
assert(false);
else
fail(p+1, fail);
}
fail(0, fail);
-10
View File
@@ -1,10 +0,0 @@
fun index(req)
return {code: 200, 'body': 'Hello, world!'};
routes = {
'/': index,
'/groups': list_groups
}
res = serve(8080, routes);