summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-11-07 23:00:42 +0000
committerPaul Buetow <paul@buetow.org>2008-11-07 23:00:42 +0000
commitec175fe6a038171c4a24c9089e146a28a4343450 (patch)
tree061f789fbb4f37d5b21be40627df4450110ecc4f
parentd0122e88576f6b05e4142df3a0b25735f5e82e29 (diff)
-rw-r--r--docs/stats.txt2
-rwxr-xr-xfypebin456748 -> 456844 bytes
-rw-r--r--src/build.h2
-rw-r--r--src/core/interpret.c1
-rw-r--r--test.fy9
-rw-r--r--test.out53
6 files changed, 57 insertions, 10 deletions
diff --git a/docs/stats.txt b/docs/stats.txt
index 30d2e85..e885347 100644
--- a/docs/stats.txt
+++ b/docs/stats.txt
@@ -1,4 +1,4 @@
===> Num of C source files : 44
-===> Num of C source lines : 8001
+===> Num of C source lines : 8002
===> Num of Fype source examples : 14
===> Num of Fype source lines : 362
diff --git a/fype b/fype
index 50639bf..855003e 100755
--- a/fype
+++ b/fype
Binary files differ
diff --git a/src/build.h b/src/build.h
index d691dcb..c192ce4 100644
--- a/src/build.h
+++ b/src/build.h
@@ -35,7 +35,7 @@
#ifndef BUILD_H
#define BUILD_H
-#define BUILDNR 9612
+#define BUILDNR 9623
#define OS_FREEBSD
#endif
diff --git a/src/core/interpret.c b/src/core/interpret.c
index 37906e4..65e5fee 100644
--- a/src/core/interpret.c
+++ b/src/core/interpret.c
@@ -981,6 +981,7 @@ _term(Interpret *p_interpret) {
stack_push(p_interpret->p_stack, p_token_arr);
_NEXT
+ return (1);
}
break;
diff --git a/test.fy b/test.fy
index 84dda3a..0331c31 100644
--- a/test.fy
+++ b/test.fy
@@ -2,4 +2,11 @@
* Examples of how to use arrays
*#
-say ["string"];
+# Create a function bar, returns 0 by default
+func bar { say "bar" }
+
+# Create a multi dimensional array foo
+my foo = [bar, 1, 4/2, double "3", ["A", ["BA", "BB"]]];
+
+# Run on each element of foo recursive 'say'
+say foo;
diff --git a/test.out b/test.out
index 0e2531d..d568169 100644
--- a/test.out
+++ b/test.out
@@ -2,10 +2,49 @@
* Examples of how to use arrays
*#
-say ["string"];
-Token (id=00000, line=00005, pos=0004, type=TT_IDENT, val=say, ival=0, dval=0.000000, refs=1)
-Token (id=00001, line=00005, pos=0006, type=TT_PARANT_AL, val=[, ival=0, dval=0.000000, refs=1)
-Token (id=00002, line=00005, pos=0006, type=TT_STRING, val=string, ival=0, dval=0.000000, refs=1)
-Token (id=00003, line=00005, pos=0008, type=TT_PARANT_AR, val=], ival=0, dval=0.000000, refs=1)
-Token (id=00004, line=00005, pos=0009, type=TT_SEMICOLON, val=;, ival=0, dval=0.000000, refs=1)
-string
+# Create a function bar, it returns 0 by default
+func bar { say "bar" }
+
+# Create an array foo, print out "bar"
+my foo = [bar, 6/2, 3*3, "string", ["_A", ["__BA", "__BB"]];
+
+#
+say foo;
+Token (id=00000, line=00006, pos=0005, type=TT_FUNC, val=func, ival=0, dval=0.000000, refs=1)
+Token (id=00001, line=00006, pos=0009, type=TT_IDENT, val=bar, ival=0, dval=0.000000, refs=1)
+Token (id=00002, line=00006, pos=0011, type=TT_PARANT_CL, val={, ival=0, dval=0.000000, refs=1)
+Token (id=00003, line=00006, pos=0015, type=TT_IDENT, val=say, ival=0, dval=0.000000, refs=1)
+Token (id=00004, line=00006, pos=0016, type=TT_STRING, val=bar, ival=0, dval=0.000000, refs=1)
+Token (id=00005, line=00006, pos=0019, type=TT_PARANT_CR, val=}, ival=0, dval=0.000000, refs=1)
+Token (id=00006, line=00009, pos=0003, type=TT_MY, val=my, ival=0, dval=0.000000, refs=1)
+Token (id=00007, line=00009, pos=0007, type=TT_IDENT, val=foo, ival=0, dval=0.000000, refs=1)
+Token (id=00008, line=00009, pos=0009, type=TT_ASSIGN, val==, ival=0, dval=0.000000, refs=1)
+Token (id=00009, line=00009, pos=0011, type=TT_PARANT_AL, val=[, ival=0, dval=0.000000, refs=1)
+Token (id=00010, line=00009, pos=0014, type=TT_IDENT, val=bar, ival=0, dval=0.000000, refs=1)
+Token (id=00011, line=00009, pos=0015, type=TT_COMMA, val=,, ival=0, dval=0.000000, refs=1)
+Token (id=00012, line=00009, pos=0017, type=TT_INTEGER, val=6, ival=6, dval=0.000000, refs=1)
+Token (id=00013, line=00009, pos=0018, type=TT_DIV, val=/, ival=0, dval=0.000000, refs=1)
+Token (id=00014, line=00009, pos=0019, type=TT_INTEGER, val=2, ival=2, dval=0.000000, refs=1)
+Token (id=00015, line=00009, pos=0020, type=TT_COMMA, val=,, ival=0, dval=0.000000, refs=1)
+Token (id=00016, line=00009, pos=0022, type=TT_INTEGER, val=3, ival=3, dval=0.000000, refs=1)
+Token (id=00017, line=00009, pos=0023, type=TT_MULT, val=*, ival=0, dval=0.000000, refs=1)
+Token (id=00018, line=00009, pos=0024, type=TT_INTEGER, val=3, ival=3, dval=0.000000, refs=1)
+Token (id=00019, line=00009, pos=0025, type=TT_COMMA, val=,, ival=0, dval=0.000000, refs=1)
+Token (id=00020, line=00009, pos=0026, type=TT_STRING, val=string, ival=0, dval=0.000000, refs=1)
+Token (id=00021, line=00009, pos=0028, type=TT_COMMA, val=,, ival=0, dval=0.000000, refs=1)
+Token (id=00022, line=00009, pos=0030, type=TT_PARANT_AL, val=[, ival=0, dval=0.000000, refs=1)
+Token (id=00023, line=00009, pos=0030, type=TT_STRING, val=_A, ival=0, dval=0.000000, refs=1)
+Token (id=00024, line=00009, pos=0032, type=TT_COMMA, val=,, ival=0, dval=0.000000, refs=1)
+Token (id=00025, line=00009, pos=0034, type=TT_PARANT_AL, val=[, ival=0, dval=0.000000, refs=1)
+Token (id=00026, line=00009, pos=0034, type=TT_STRING, val=__BA, ival=0, dval=0.000000, refs=1)
+Token (id=00027, line=00009, pos=0036, type=TT_COMMA, val=,, ival=0, dval=0.000000, refs=1)
+Token (id=00028, line=00009, pos=0037, type=TT_STRING, val=__BB, ival=0, dval=0.000000, refs=1)
+Token (id=00029, line=00009, pos=0039, type=TT_PARANT_AR, val=], ival=0, dval=0.000000, refs=1)
+Token (id=00030, line=00009, pos=0039, type=TT_SEMICOLON, val=;, ival=0, dval=0.000000, refs=1)
+Token (id=00031, line=00009, pos=0040, type=TT_PARANT_AR, val=], ival=0, dval=0.000000, refs=1)
+Token (id=00032, line=00009, pos=0041, type=TT_SEMICOLON, val=;, ival=0, dval=0.000000, refs=1)
+Token (id=00033, line=00012, pos=0004, type=TT_IDENT, val=say, ival=0, dval=0.000000, refs=1)
+Token (id=00034, line=00012, pos=0008, type=TT_IDENT, val=foo, ival=0, dval=0.000000, refs=1)
+Token (id=00035, line=00012, pos=0009, type=TT_SEMICOLON, val=;, ival=0, dval=0.000000, refs=1)
+bar
+No such symbol: Interpret error in ./test.fy line 12 pos 8 near 'foo' (Fype @ ./src/core/interpret.c line 874)