aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorBruce Hill <bitbucket@bruce-hill.com>2017-12-30 14:31:07 -0800
committerBruce Hill <bitbucket@bruce-hill.com>2017-12-30 14:31:07 -0800
commit4789892824237dfb45d5f1cfb3442bfede34eeac (patch)
tree32a32f66263f20d4b65ed8dbef8e0ee733366214 /lib
parent21a6314e270344e6923bb4f0a06fd09b0d9ae581 (diff)
Got everything mostly working.
Diffstat (limited to 'lib')
-rw-r--r--lib/control_flow.nom4
-rw-r--r--lib/metaprogramming.nom5
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/control_flow.nom b/lib/control_flow.nom
index b7b5f19..7658ae1 100644
--- a/lib/control_flow.nom
+++ b/lib/control_flow.nom
@@ -31,10 +31,10 @@ compile [go to %label] to code: ".."
rule [tree %tree has function call %call] =:
lua> ".."
- local target = (\(%call)).value;
+ local target = (\(%call)).stub;
for subtree,_ in coroutine.wrap(function() nomsu:walk_tree(\(%tree)); end) do
if type(subtree) == 'table' and subtree.type == "FunctionCall"
- and nomsu.utils.equivalent(subtree.value, target, 2) then
+ and subtree.stub == target then
return true;
end
end
diff --git a/lib/metaprogramming.nom b/lib/metaprogramming.nom
index 95deb0c..e86b904 100644
--- a/lib/metaprogramming.nom
+++ b/lib/metaprogramming.nom
@@ -27,6 +27,11 @@ rule [compile \%macro_def to \%body] =:
local thunk = nomsu:tree_to_value(body);
nomsu:defmacro(signature, thunk, ("compile %s\\n..to %s"):format(vars.macro_def.src, body.src));
+compile [fizz %n] to:
+ "print(\(%n as lua))"
+compile [pumpo] to:
+ "print('pumpo')"
+
rule [compile \%macro_def to code \%body] =:
lua> ".."
local signature = {};