From 06b5904e470b5295a6f09b6f85f21cb8172e13be Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Fri, 6 Aug 2021 14:08:49 -0400 Subject: class -> role in a few places --- docs/commentary/problems.html | 2 +- docs/doc/context.html | 2 +- docs/spec/grammar.html | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/commentary/problems.html b/docs/commentary/problems.html index d1dd2c17..0518a34f 100644 --- a/docs/commentary/problems.html +++ b/docs/commentary/problems.html @@ -179,7 +179,7 @@

Stranding gotchas

Fixed with list notation, which descends from the array notation developed by Phil Last and later Adám Brudzewsky. The problem that array notation has much more cluttered syntax than stranding has pretty much been fixed by the ligature character , which I discovered during proto-BQN discussions.

Functions are not first class

-

Fixed by allowing a variable to be written with a different syntactic class than it was created with, suggested by Adám in proto-BQN discussions.

+

Fixed by allowing a variable to be written with a different syntactic role than it was created with, suggested by Adám in proto-BQN discussions.

APL is not context-free

Fixed with the casing conventions for variable names, which I think I first saw in APL\iv, although the cases are swapped relative to BQN.

Selective assignment requires a named variable

diff --git a/docs/doc/context.html b/docs/doc/context.html index b08f70a0..1e73eced 100644 --- a/docs/doc/context.html +++ b/docs/doc/context.html @@ -12,7 +12,7 @@
b(a, d(c)(e))
 (b a ((d c) e))
 
-

In each case, some values are used as inputs to functions while others are the functions being applied. The result of a function can be used either as an input or as a function again. These expressions correspond to the APL expression where a and e are arrays, b and c are functions, and d is a monadic operator. However, these syntactic classes have to be known to see what the APL expression is doing—they are a form of context that is required for a reader to know the grammatical structure of the expression. In a context-free grammar like that of simple C or Lisp expressions, a value's grammatical role is part of the expression itself, indicated with parentheses: they come after the function in C and before it in Lisp. Of course, a consequence of using parentheses in this way is having a lot of parentheses. BQN uses a different method to annotate grammatical role:

+

In each case, some values are used as inputs to functions while others are the functions being applied. The result of a function can be used either as an input or as a function again. These expressions correspond to the APL expression where a and e are arrays, b and c are functions, and d is a monadic operator. However, these syntactic roles have to be known to see what the APL expression is doing—they are a form of context that is required for a reader to know the grammatical structure of the expression. In a context-free grammar like that of simple C or Lisp expressions, a value's grammatical role is part of the expression itself, indicated with parentheses: they come after the function in C and before it in Lisp. Of course, a consequence of using parentheses in this way is having a lot of parentheses. BQN uses a different method to annotate grammatical role:

a B C _d e
 

Here, the lowercase spelling indicates that a and e are to be treated as subjects ("arrays" in APL) while the uppercase spelling of variables B and C are used as functions and _d is a 1-modifier ("monadic operator"). Like parentheses for function application, the spelling is not inherent to the variable values used, but instead indicates their grammatical role in this particular expression. A variable has no inherent spelling and can be used in any role, so the names a, A, _a, and _a_ all refer to exact same variable, but in different roles; typically we use the lowercase name to refer to the variable in isolation—all values are nouns when speaking about them in English. While we still don't know anything about what values a, b, c, and so on have, we know how they interact in the line of code above.

diff --git a/docs/spec/grammar.html b/docs/spec/grammar.html index ca000bc6..419eb406 100644 --- a/docs/spec/grammar.html +++ b/docs/spec/grammar.html @@ -6,7 +6,7 @@

Specification: BQN grammar

BQN's grammar is given below. Terms are defined in a BNF variant. However, handling special names properly is possible but difficult in BNF, so they are explained in text along with the braced block grammar.

-

The symbols s, F, _m, and _c_ are identifier tokens with subject, function, 1-modifier, and 2-modifier classes respectively. Similarly, sl, Fl, _ml, and _cl_ refer to literals and primitives of those classes. While names in the BNF here follow the identifier naming scheme, this is informative only: syntactic classes are no longer used after parsing and cannot be inspected in a running program.

+

The symbols s, F, _m, and _c_ are identifier tokens with subject, function, 1-modifier, and 2-modifier classes respectively. Similarly, sl, Fl, _ml, and _cl_ refer to literals and primitives of those classes. While names in the BNF here follow the identifier naming scheme, this is informative only: syntactic roles are no longer used after parsing and cannot be inspected in a running program.

A program is a list of statements. Almost all statements are expressions. Namespace export statements, and valueless results stemming from ·, or 𝕨 in a monadic brace function, can be used as statements but not expressions.

PROGRAM  = ? ( STMT  )* STMT ?
 STMT     = EXPR | nothing | EXPORT
-- 
cgit v1.2.3