From 449a939963a0b555faaf15a193fb5a37a3dda8a6 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Sun, 21 Jun 2020 17:48:00 -0400 Subject: Brace-construct typing is actually context-free --- doc/context.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'doc/context.md') diff --git a/doc/context.md b/doc/context.md index 7a9e218d..0aab2b93 100644 --- a/doc/context.md +++ b/doc/context.md @@ -42,12 +42,12 @@ BQN's variables use another system. Unlike primitives, variables can be spelled The associations between spelling and syntactic role are considered part of BQN's [token formation rules](../spec/token.md). +One rule for typing is also best considered to be a pre-parsing rule like the spelling system: the role of a brace construct `{}` is determined by which special arguments it uses: it's a value if there are none, but a `𝕨` or `𝕩` makes it at least a function, an `𝔽` makes it a modifier or composition, and a `𝔾` always makes it a composition. + ## BQN's grammar A formal treatment is included in [the spec](../spec/grammar.md). BQN's grammar—the ways syntactic roles interact—follows the original APL model (plus trains) closely, with allowances for new features like list notation. In order to keep BQN's syntax context-free, the syntactic role of any expression must be known, just like tokens. -BQN fails to be context-free in one fairly mild way: the role of a brace construct `{}` is determined by which special arguments it uses. This means the grammar is not context-free in the technical sense, but since the "context" in this case is carried between the braces and cannot be left out it's not harmful in the same way as variable values. Informally it still makes sense to call BQN "context-free". - Here is a table of the APL-derived operator and function application rules: | left | main | right | output | name -- cgit v1.2.3