diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-16 20:39:10 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-16 20:39:10 -0400 |
| commit | 225a30537acfeb3efe2a7730e5d1a063cc537047 (patch) | |
| tree | 5156e88b11ab1a3baccded91c77acbe8670f02ce /spec/grammar.md | |
| parent | 2a06176dd6920c26f02e63f8a3f266b59d10a7ed (diff) | |
Add return functions to the spec
Diffstat (limited to 'spec/grammar.md')
| -rw-r--r-- | spec/grammar.md | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/spec/grammar.md b/spec/grammar.md index c79cbc71..1cc31126 100644 --- a/spec/grammar.md +++ b/spec/grammar.md @@ -34,11 +34,13 @@ Starting at the highest-order objects, modifiers have fairly simple syntax. In m | Operand _mod2_ # Left partial application | _m ASGN _m1Expr -Functions can be formed by fully applying modifiers or as trains. modifiers are left-associative, so that the left operand (`Operand`) can include modifier applications but the right operand (`subject | Func`) cannot. Trains are right-associative, but bind less tightly than modifiers. Assignment is not allowed in the top level of a train: it must be parenthesized. +Functions can be formed by fully applying modifiers, as trains, or with the return token `โ`, which behaves syntactically like a 1-modifier whose operand must be an identifier. Modifiers are left-associative, so that the left operand (`Operand`) can include modifier applications but the right operand (`subject | Func`) cannot. Trains are right-associative, but bind less tightly than modifiers. Assignment is not allowed in the top level of a train: it must be parenthesized. Derv = Func | Operand _mod1 | Operand _mod2_ ( subject | Func ) + | Return + Return = ( NAME | "๐" | "๐ฃ" ) "โ" Operand = subject | Derv Fork = Derv @@ -55,11 +57,11 @@ Subject expressions are complicated by the possibility of list and namespace ass | ( subject | nothing )? Derv arg nothing = "ยท" | ( subject | nothing )? Derv nothing - LHS_NAME = s | F | _m | _c_ - LHS_ANY = LHS_NAME | lhsList + NAME = s | F | _m | _c_ + LHS_ANY = NAME | lhsList LHS_ATOM = LHS_ANY | "(" lhsStr ")" LHS_ELT = LHS_ANY | lhsStr - LHS_ENTRY= LHS_ELT | lhs "โ" LHS_NAME + LHS_ENTRY= LHS_ELT | lhs "โ" NAME lhsStr = LHS_ATOM ( "โฟ" LHS_ATOM )+ lhsList = "โจ" โ? ( ( LHS_ENTRY โ )* LHS_ENTRY โ? )? "โฉ" lhs = s | lhsList | lhsStr |
