summaryrefslogtreecommitdiff
path: root/test.toc
diff options
context:
space:
mode:
Diffstat (limited to 'test.toc')
-rw-r--r--test.toc32
1 files changed, 24 insertions, 8 deletions
diff --git a/test.toc b/test.toc
index d672753..afb40bb 100644
--- a/test.toc
+++ b/test.toc
@@ -3,14 +3,30 @@
#include "std/base.toc", base;
main ::= fn() {
- file, _ := io.fopen_write("test.txt");
- io.writes("What is your name? ");
- b : [64]char;
- name := b[:];
- err := io.gets(&name, file);
+ file, err := io.fopen_read("test.txt");
if err {
- base.error("File error");
+ base.error("Couldn't open file.");
}
- io.writes("Hello, ");
- io.puts(name);
+ defer io.fclose(file);
+ buf : [3]char;
+ while !err {
+ s := buf[:];
+ err = io.fread(file, &s);
+ io.writes(s);
+ }
+}
+
+/*
+// @TODO: fix this
+
+bar ::= fn() (int, int) {
+ return foo();
+}
+foo ::= fn() (int, int) {
+ return 3, 5;
+}
+
+main ::= fn() {
+ a, b := foo();
}
+*/