summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2020-01-22 21:41:34 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2020-01-23 20:24:22 -0500
commit3fa3c17a12cb52edbcc9890cad59d610e0360f90 (patch)
tree69c5b12ce0e82aab5e7d0a0b56aad6457703d06d /tests
parent5076866caf273afa8ac21ead4fafaa6c4d233f9a (diff)
improved parsing fn types; fixed tests
Diffstat (limited to 'tests')
-rw-r--r--tests/arr/arr.toc8
-rw-r--r--tests/arr2/arr2.toc2
-rw-r--r--tests/bf/bf.toc2
3 files changed, 8 insertions, 4 deletions
diff --git a/tests/arr/arr.toc b/tests/arr/arr.toc
index 4cabd9e..d18e8ea 100644
--- a/tests/arr/arr.toc
+++ b/tests/arr/arr.toc
@@ -1,10 +1,10 @@
puti ::= fn(x: int) {
- #C("printf(\"%ld\\n\", (long)x);
-");
+ #C("extern int printf(const char *fmt, ...)");
+ #C("printf(\"%ld\\n\", (long)x)");
};
putf ::= fn(x: float) {
- #C("printf(\"%f\\n\", (double)x);
-");
+ #C("extern int printf(const char *fmt, ...)");
+ #C("printf(\"%f\\n\", (double)x)");
};
// it would be nice if Arr.data.len == Arr.len (: but this will require some C code...
diff --git a/tests/arr2/arr2.toc b/tests/arr2/arr2.toc
index ea9ea79..7056416 100644
--- a/tests/arr2/arr2.toc
+++ b/tests/arr2/arr2.toc
@@ -1,8 +1,10 @@
puti ::= fn(x: int) {
+ #C("extern int printf(const char *fmt, ...)");
#C("printf(\"%ld\\n\", (long)x);
");
};
putf ::= fn(x: float) {
+ #C("extern int printf(const char *fmt, ...)");
#C("printf(\"%f\\n\", (double)x);
");
};
diff --git a/tests/bf/bf.toc b/tests/bf/bf.toc
index b624101..c2f9970 100644
--- a/tests/bf/bf.toc
+++ b/tests/bf/bf.toc
@@ -32,10 +32,12 @@ getstdin ::= fn() []char {
};
puti ::= fn(x: int) {
+ #C("extern int printf(const char *fmt, ...)");
#C("printf(\"%ld\\n\", x)");
};
main ::= fn() {
+ #C("extern int putchar(int c)");
code := getstdin();
tape_sz := 3;
tape := new(int, tape_sz);