From e416644a9b0837425d016f64ff04100c25dc813e Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 12 Oct 2020 22:01:06 -0400 Subject: Rename NS_STMT to IMPORT --- docs/spec/grammar.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'docs/spec') diff --git a/docs/spec/grammar.html b/docs/spec/grammar.html index a36e02bb..df9308df 100644 --- a/docs/spec/grammar.html +++ b/docs/spec/grammar.html @@ -7,10 +7,10 @@

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.

-

A program is a list of statements. Almost all statements are expressions. Valueless results stemming from ยท, or ๐•จ in a monadic brace function, can be used as statements but not expressions. "Namespace statements", which import multiple values from a namespace block (immediate block containing โ‡), also cannot be expressions. An extension to BQN to allow first-class namespaces would extend ordinary expressions so that NS_STMT would no longer be needed, as it would be a subset of EXPR.

+

A program is a list of statements. Almost all statements are expressions. Valueless results stemming from ยท, or ๐•จ in a monadic brace function, can be used as statements but not expressions. "Namespace statements", which import multiple values from a namespace block (immediate block containing โ‡), also cannot be expressions. An extension to BQN to allow first-class namespaces would extend ordinary expressions so that IMPORT would no longer be needed, as it would be a subset of EXPR.

PROGRAM  = โ‹„? ( ( STMT โ‹„ )* STMT โ‹„? )?
 STMT     = BSTMT | EXPORT
-BSTMT    = EXPR | nothing | NS_STMT
+BSTMT    = EXPR | nothing | IMPORT
 โ‹„        = ( "โ‹„" | "," | \n )+
 EXPR     = subExpr | FuncExpr | _m1Expr | _m2Expr_
 
@@ -89,7 +89,7 @@ _brMod2_ = "{" ( _cCase_ ";" )* ( _cCase_ | _cMan_ ( ";" _cMan_ )? ) "}"

A namespace block is very similar in grammar to an ordinary immediate block, but allows export declarations with โ‡, either in place of the ordinary definition โ† or in the special EXPORT statement. The arrow โ‡ can also be placed in the header to mark a namespace block. Since the block returns all exported values and not the result of the last line, the last line does not need to be an expression.

-
NS_STMT  = nsLHS ASGN brNS
+
IMPORT   = nsLHS ASGN brNS
 NS_VAR   = ( lhs "โ‡" )? LHS_NAME
 nsLHS    = LHS_NAME ( "โ€ฟ" LHS_NAME )+
          | "โŸจ" โ‹„? ( ( NS_VAR โ‹„ )* NS_VAR โ‹„? )? "โŸฉ"
-- 
cgit v1.2.3