aboutsummaryrefslogtreecommitdiff
path: root/spec/grammar.md
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-03-24 22:41:38 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-03-24 22:41:38 -0400
commit46e989035fa921a5a32169cc0a9b897ec313cc2e (patch)
treed92737c676f75ef4e752cff095b36fe20a5dfe09 /spec/grammar.md
parent51ddc6a0797452b0f4ae977133038ce2439fbead (diff)
Specify function Undo headers
Diffstat (limited to 'spec/grammar.md')
-rw-r--r--spec/grammar.md7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/grammar.md b/spec/grammar.md
index af1bb52d..c79cbc71 100644
--- a/spec/grammar.md
+++ b/spec/grammar.md
@@ -78,9 +78,16 @@ A header looks like a name for the thing being headed, or its application to inp
FuncHead = headW? ( F | "𝕊" ) headX
| sl | "(" subExpr ")" | brSub | list # subject,
| ANY ( "‿" ANY )+ # but not s
+ | UndoHead
_m1Head = headW? Mod1H1 headX
_m2Head_ = headW? Mod2H1 headX
+Additionally, an inference header doesn't affect evaluation of the function, but describes how an inferred property ([Undo](inferred.md#undo)) should be computed. Here `"˜"` and `"⁼"` are both specific instances of the `_ml` token.
+
+ UndoHead = headW? ( F | "𝕊" ) "⁼" headX
+ | headW ( F | "𝕊" ) "˜" "⁼" headX
+ | ( F | "𝕊" ) "˜"? "⁼"
+
A braced block contains bodies, which are lists of statements, separated by semicolons and possibly preceded by headers, which are separated from the body with a colon. Multiple bodies allow different handling for various cases, which are pattern-matched by headers. For an immediate block there are no inputs, so there can only be one possible case and one body. Functions and modifiers allow any number of "matched" bodies, with headers that have arguments, followed by at most two "main" bodies with either no headers or headers without arguments. If there is one main body, it is ambivalent, but two main bodies refer to the monadic and dyadic cases.
BODY = PROGRAM