diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-10-12 22:01:06 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-10-12 22:05:53 -0400 |
| commit | e416644a9b0837425d016f64ff04100c25dc813e (patch) | |
| tree | fafe629f653f247206042c511b21492094855e28 /spec | |
| parent | cebb1bcfcec64f8d0dc888466b1c99b7069d258c (diff) | |
Rename NS_STMT to IMPORT
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/grammar.md | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/spec/grammar.md b/spec/grammar.md index 91cf043e..8fc9534f 100644 --- a/spec/grammar.md +++ b/spec/grammar.md @@ -6,11 +6,11 @@ BQN's grammar is given below. Terms are defined in a [BNF](https://en.wikipedia. 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_ @@ -96,7 +96,7 @@ A braced block contains bodies, which are lists of statements, separated by semi 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 โ? )? "โฉ" |
