summaryrefslogtreecommitdiff
path: root/test.toc
diff options
context:
space:
mode:
Diffstat (limited to 'test.toc')
-rw-r--r--test.toc34
1 files changed, 28 insertions, 6 deletions
diff --git a/test.toc b/test.toc
index 3f059a4..9b805fc 100644
--- a/test.toc
+++ b/test.toc
@@ -1,12 +1,34 @@
#include "std/io.toc", io;
+#include "std/mem.toc", mem;
+
+use mem;
main ::= fn() {
- s ::= struct {
- foo, e: int;
- bar ::= 3;
- baz: float;
+ Point ::= struct {
+ x: int;
+ y: int;
+ a ::= 3;
+ }
+
+ use io;
+
+ {
+ use p: Point;
+ use io;
+ x = 5;
+ puti(x);
}
- p: s;
- io.puti(p["bar"]);
+ ps := news(Point, 5);
+ for use p, i := &ps {
+ x = i;
+ y = 2*i;
+ }
+ for use p := ps {
+ writei(x);
+ writes(" ");
+ writei(y);
+ puts("");
+ }
+ dels(ps);
}