aboutsummaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-06-19 23:05:07 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-06-19 23:05:07 -0400
commitc24bb47929e2e82b742310a20216a72df5aac893 (patch)
treef4554765e9e78b7d0a0e2ce5feaf8da0d3f816e3 /spec
parent412a732271851b976eafd3d69b2a361a847a7f6c (diff)
Add braced arrays (containing no special arguments or operands)
Diffstat (limited to 'spec')
-rw-r--r--spec/grammar.md12
-rw-r--r--spec/reference.bqn2
2 files changed, 7 insertions, 7 deletions
diff --git a/spec/grammar.md b/spec/grammar.md
index 5d30774f..1f863a1b 100644
--- a/spec/grammar.md
+++ b/spec/grammar.md
@@ -12,11 +12,11 @@ A program is a list of statements. Almost all statements are expressions. Howeve
Here we define the "atomic" forms of functions and operators, which are either single tokens or enclosed in paired symbols. Stranded vectors with `‿`, which binds more tightly than any form of execution, are also included.
ANY = atom | Func | _mod | _comp_
- _comp_ = _c_ | _cl_ | _braceComp_ | "(" _cmpExp_ ")"
- _mod = _m | _ml | _braceMod | "(" _modExpr ")"
- Func = F | Fl | BraceFunc | "(" FuncExpr ")"
- atom = v | vl | list | "(" valExpr ")"
- list = "⟨" ⋄? ( ( EXPR ⋄ )* EXPR ⋄? )? "⟩"
+ _comp_ = _c_ | _cl_ | "(" _cmpExp_ ")" | _braceComp_
+ _mod = _m | _ml | "(" _modExpr ")" | _braceMod
+ Func = F | Fl | "(" FuncExpr ")" | BraceFunc
+ atom = v | vl | "(" valExpr ")" | braceVal
+ | "⟨" ⋄? ( ( EXPR ⋄ )* EXPR ⋄? )? "⟩"
value = atom | ANY ( "‿" ANY )+
Starting at the highest-order objects, modifiers and compositions have fairly simple syntax. In most cases the syntax for `←` and `↩` is the same, but only `↩` can be used for modified assignment.
@@ -60,6 +60,6 @@ Value expressions are complicated by the possibility of list assignment. We also
| v ASGN valExpr
| v Derv "↩" valExpr ⍝ Modified assignment
-One aspect of BQN grammar is not context-free: determining the syntactic class of a brace definition. The terms `BraceFunc` `_braceMod` `_braceComp_` all obey the syntax for `BRACED` given below. Then the class is determined by the presence of `𝕗` and `𝕘` (including alternate class spellings) at the top level, that is, not contained within further pairs of braces. If `𝕘` is present, it is a `_braceCmp_`; otherwise, if `𝕗` is present it it a `_braceMod` and otherwise a `BraceFunc`. The presence of `𝕨` or `𝕩` has an effect on the evaluation of modifiers and combinators but not their syntactic class.
+One aspect of BQN grammar is not context-free: determining the syntactic class of a brace definition. The terms `braceVal`, `BraceFunc` `_braceMod` `_braceComp_` all obey the syntax for `BRACED` given below. Then the class is determined by the presence of `𝕨`, `𝕩`, `𝕗`, and `𝕘` (including alternate class spellings) at the top level, that is, not contained within further pairs of braces. If `𝕘` is present, it is a `_braceCmp_`; otherwise, if `𝕗` is present it is a `_braceMod`; otherwise is is a `BraceFunc` if `𝕨` or `𝕩` are present and a `braceVal` if no special names appear.
BRACED = "{" ⋄? ( STMT ⋄ )* EXPR ⋄? "}"
diff --git a/spec/reference.bqn b/spec/reference.bqn
index db001bfb..5c4c48db 100644
--- a/spec/reference.bqn
+++ b/spec/reference.bqn
@@ -79,7 +79,7 @@ _eachm←{
_reduce←{
! 1=≠≢𝕩
l←≠v←𝕩 ⋄ F←𝔽
- r←𝕨 (0<l)◶{Identity f}‿{l↩l-1⋄(l-1)⊑𝕩}⊘⊣ 𝕩
+ r←𝕨 (0<l)◶{𝕩⋄Identity f}‿{l↩l-1⋄(l-1)⊑𝕩}⊘⊣ 𝕩
{r↩(𝕩⊑v)F r}¨(l-1)⊸-¨↕l
r
}