summaryrefslogtreecommitdiffstats
path: root/compile.c
diff options
context:
space:
mode:
authorStephen Dolan <mu@netsoc.tcd.ie>2013-05-06 14:21:00 +0100
committerStephen Dolan <mu@netsoc.tcd.ie>2013-05-06 14:21:00 +0100
commit5be97463ecd4f93fdfbaec457d9100beeb9dc603 (patch)
treec60380d11fa33623ceb683189b12bf411bd24244 /compile.c
parent48be23233ad63bf1bd218c259efedff3e52106c5 (diff)
Add a --arg option to allow variables to be passed from the cmdline.
Closes #107
Diffstat (limited to 'compile.c')
-rw-r--r--compile.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/compile.c b/compile.c
index 69044626..77dfd904 100644
--- a/compile.c
+++ b/compile.c
@@ -371,6 +371,12 @@ block gen_or(block a, block b) {
gen_const(jv_false())))));
}
+block gen_var_binding(block var, const char* name, block body) {
+ return BLOCK(gen_op_simple(DUP), var,
+ block_bind(gen_op_var_unbound(STOREV, name),
+ body, OP_HAS_VARIABLE));
+}
+
block gen_cond(block cond, block iftrue, block iffalse) {
return BLOCK(gen_op_simple(DUP), cond,
gen_condbranch(BLOCK(gen_op_simple(POP), iftrue),