diff --git a/anselme/common/init.lua b/anselme/common/init.lua index 14aacf8..bdad1ce 100644 --- a/anselme/common/init.lua +++ b/anselme/common/init.lua @@ -43,7 +43,7 @@ local common = { }, infixes = { { ";", 1 }, - { "#", 2 }, { "->", 2 }, { "~>", 2 }, + { "#", 2 }, { "->", 2 }, { "~", 4 }, { "~?", 4 }, { "|>", 5 }, { "&", 5 }, { "|", 5 }, { "==", 7 }, { "!=", 7 }, { ">=", 7 }, { "<=", 7 }, { "<", 7 }, { ">", 7 }, diff --git a/anselme/parser/expression/secondary/infix/resume.lua b/anselme/parser/expression/secondary/infix/resume.lua deleted file mode 100644 index 593622a..0000000 --- a/anselme/parser/expression/secondary/infix/resume.lua +++ /dev/null @@ -1,9 +0,0 @@ -local infix_quote_right = require("anselme.parser.expression.secondary.infix.infix_quote_right") - -local operator_priority = require("anselme.common").operator_priority - -return infix_quote_right { - operator = "~>", - identifier = "_~>_", - priority = operator_priority["_~>_"] -} diff --git a/anselme/parser/expression/secondary/init.lua b/anselme/parser/expression/secondary/init.lua index 84171a2..08b50a3 100644 --- a/anselme/parser/expression/secondary/init.lua +++ b/anselme/parser/expression/secondary/init.lua @@ -12,7 +12,6 @@ local secondaries = { r("infix.tuple"), r("infix.tag"), r("infix.translate"), - r("infix.resume"), -- 4 r("infix.while"), r("infix.if"), diff --git a/anselme/stdlib/checkpoint.lua b/anselme/stdlib/checkpoint.lua index 7631d5a..dcb63b6 100644 --- a/anselme/stdlib/checkpoint.lua +++ b/anselme/stdlib/checkpoint.lua @@ -4,27 +4,18 @@ local ArgumentTuple, Boolean, Nil = ast.ArgumentTuple, ast.Boolean, ast.Nil local resume_manager = require("anselme.state.resume_manager") return { - { - "_~>_", "(anchor::anchor, quote)", - function(state, anchor, quote) - resume_manager:push(state, anchor) - local r = quote:call(state, ArgumentTuple:new()) - resume_manager:pop(state) - return r - end - }, - { - "_~>_", "(anchor::nil, quote)", - function(state, anchor, quote) - return quote:call(state, ArgumentTuple:new()) - end - }, { "resume", "(function::closure, anchor::anchor)", function(state, func, anchor) return func:resume(state, anchor) end }, + { + "resume", "(function::closure, anchor::nil)", + function(state, func) + return func:call(state, ArgumentTuple:new()) + end + }, { "resuming", "()", function(state) diff --git a/ideas.md b/ideas.md index 5a4ef9a..2ea2909 100644 --- a/ideas.md +++ b/ideas.md @@ -68,6 +68,8 @@ Syntax modifications: Could interpret the left operand as a string when it is an identifier, like how _._ works. Would feel good to have less nodes. But because we can doesn't mean we should. Also Assignment is reused in a few other places. + - remove operators if possible, i'd like to avoid the code looking like a bunch of sigils + --- Reduce the number of AST node types ; try to merge similar node and make simpler individuals nodes if possible by composing them. diff --git a/test/tests/resume anchors.ans b/test/tests/resume anchors.ans index 2a8c81b..57cda80 100644 --- a/test/tests/resume anchors.ans +++ b/test/tests/resume anchors.ans @@ -8,7 +8,7 @@ :f = $(anchor=()) :x = 8 - anchor ~> + ($_)!resume(anchor) |a | A |> | b