summaryrefslogtreecommitdiffstats
path: root/parser.y
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2012-12-28 15:07:27 +0000
committerStephen Dolan <mu@netsoc.tcd.ie>2012-12-28 15:07:27 +0000
commitf1e23448e789983f8581f291e56a37c3c63e7dbf (patch)
treeb11cd43a78031473f2695c9ac90f1df562a06f71 /parser.y
parent417899f9a02f8957e30fc6252cf0e02b713c4c4a (diff)
Support for two-argument functions.
Should probably support n args instead. This is a quick hack. Also, ';' is a slightly ugly argument separator.
Diffstat (limited to 'parser.y')
-rw-r--r--parser.y16
1 files changed, 16 insertions, 0 deletions
diff --git a/parser.y b/parser.y
index 5cc2640f..2b9732c0 100644
--- a/parser.y
+++ b/parser.y
@@ -319,9 +319,20 @@ FuncDef:
$7);
jv_free($2);
jv_free($4);
+} |
+
+"def" IDENT '(' IDENT ';' IDENT ')' ':' Exp ';' {
+ $$ = gen_function(jv_string_value($2),
+ BLOCK(gen_op_block_unbound(CLOSURE_PARAM, jv_string_value($4)),
+ gen_op_block_unbound(CLOSURE_PARAM, jv_string_value($6))),
+ $9);
+ jv_free($2);
+ jv_free($4);
+ jv_free($6);
}
+
String:
QQSTRING_START { $<literal>$ = jv_string("text"); } QQString QQSTRING_END {
$$ = $3;
@@ -414,6 +425,11 @@ IDENT '(' Exp ')' {
$$ = gen_location(@1, $$);
jv_free($1);
} |
+IDENT '(' Exp ';' Exp ')' {
+ $$ = gen_call(jv_string_value($1), BLOCK(gen_lambda($3), gen_lambda($5)));
+ $$ = gen_location(@1, $$);
+ jv_free($1);
+} |
'(' error ')' { $$ = gen_noop(); } |
'[' error ']' { $$ = gen_noop(); } |
Term '[' error ']' { $$ = $1; } |