-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
13 changed files
with
592 additions
and
2 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
Prism.languages.bqn = { | ||
'shebang': { | ||
pattern: /^#![ \t]*\/.*/, | ||
alias: 'important', | ||
greedy: true | ||
}, | ||
'comment': { | ||
pattern: /#.*/, | ||
greedy: true | ||
}, | ||
'string-literal': { | ||
pattern: /"(?:[^"]|"")*"/, | ||
greedy: true, | ||
alias: 'string' | ||
}, | ||
'character-literal': { | ||
pattern: /'(?:[\s\S]|[\uD800-\uDBFF][\uDC00-\uDFFF])'/, | ||
greedy: true, | ||
alias: 'char' | ||
}, | ||
'function': /•[\w¯.∞π]+[\w¯.∞π]*/, | ||
'dot-notation-on-brackets': { | ||
pattern: /\{(?=.*\}\.)|\}\./, | ||
alias: 'namespace' | ||
}, | ||
'special-name': { | ||
pattern: /(?:𝕨|𝕩|𝕗|𝕘|𝕤|𝕣|𝕎|𝕏|𝔽|𝔾|𝕊|_𝕣_|_𝕣)/, | ||
alias: 'keyword' | ||
}, | ||
'dot-notation-on-name': { | ||
pattern: /[A-Za-z_][\w¯∞π]*\./, | ||
alias: 'namespace' | ||
}, | ||
'word-number-scientific': { | ||
pattern: /\d+(?:\.\d+)?[eE]¯?\d+/, | ||
alias: 'number' | ||
}, | ||
'word-name': { | ||
pattern: /[A-Za-z_][\w¯∞π]*/, | ||
alias: 'symbol' | ||
}, | ||
'word-number': { | ||
pattern: /[¯∞π]?(?:\d*\.?\b\d+(?:e[+¯]?\d+|E[+¯]?\d+)?|¯|∞|π)(?:j¯?(?:(?:\d+(?:\.\d+)?|\.\d+)(?:e[+¯]?\d+|E[+¯]?\d+)?|¯|∞|π))?/, | ||
alias: 'number' | ||
}, | ||
'null-literal': { | ||
pattern: /@/, | ||
alias: 'char' | ||
}, | ||
'primitive-functions': { | ||
pattern: /[-+×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!]/, | ||
alias: 'operator' | ||
}, | ||
'primitive-1-operators': { | ||
pattern: /[`˜˘¨⁼⌜´˝˙]/, | ||
alias: 'operator' | ||
}, | ||
'primitive-2-operators': { | ||
pattern: /[∘⊸⟜○⌾⎉⚇⍟⊘◶⎊]/, | ||
alias: 'operator' | ||
}, | ||
'punctuation': /[←⇐↩(){}⟨⟩[\]‿·⋄,.;:?]/ | ||
}; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
<h2>Examples From Rosetta Code</h2> | ||
<h3>100 Doors</h3> | ||
<pre><code> | ||
swch ← ≠´{100⥊1«𝕩⥊0}¨1+↕100 | ||
¯1↓∾{𝕩∾@+10}¨•Fmt¨⟨swch,/swch⟩ | ||
</code></pre> | ||
<h3>Archimedean Spiral</h3> | ||
<pre><code> | ||
{(•math.Sin •Plot○(⊢×↕∘≠) •math.Cos) -(2×π) × 𝕩⥊(↕÷-⟜1)100} | ||
</code></pre> | ||
<h3>Damm Algorithm</h3> | ||
<pre><code> | ||
table ← >⟨ 0‿3‿1‿7‿5‿9‿8‿6‿4‿2 | ||
7‿0‿9‿2‿1‿5‿4‿8‿6‿3 | ||
4‿2‿0‿6‿8‿7‿1‿3‿5‿9 | ||
1‿7‿5‿0‿9‿8‿3‿4‿2‿6 | ||
6‿1‿2‿3‿0‿4‿5‿9‿7‿8 | ||
3‿6‿7‿4‿2‿0‿9‿5‿8‿1 | ||
5‿8‿6‿9‿7‿2‿0‿1‿3‿4 | ||
8‿9‿4‿5‿3‿6‿2‿0‿1‿7 | ||
9‿4‿3‿8‿6‿1‿7‿2‿0‿5 | ||
2‿5‿8‿1‿4‿3‿6‿7‿9‿0 ⟩ | ||
|
||
|
||
Digits ← 10{⌽𝕗|⌊∘÷⟜𝕗⍟(↕1+·⌊𝕗⋆⁼1⌈⊢)} | ||
|
||
Damm ← {0=0(table⊑˜⋈)˜´⌽Digits 𝕩} | ||
|
||
Damm¨5724‿5727‿112946 | ||
</code></pre> | ||
<h3>Knuth/Fisher-Yates Shuffle</h3> | ||
<pre><code> | ||
Knuth ← { | ||
𝕊 arr: | ||
l ← ≠arr | ||
{ | ||
arr ↩ ⌽⌾(⟨•rand.Range l, 𝕩⟩⊸⊏)arr | ||
}¨↕l | ||
arr | ||
} | ||
P ← •Show Knuth | ||
|
||
P ⟨⟩ | ||
P ⟨10⟩ | ||
P ⟨10, 20⟩ | ||
P ⟨10, 20, 30⟩ | ||
</code></pre> | ||
<h2>Comments</h2> | ||
<pre><code>#!/usr/bin/env bqn | ||
# Full Line Comment | ||
'#' # The preceding should not be a comment. | ||
"BQN is #1" # The preceding should not be a comment. | ||
1 + 1 # Comment at End of Line. | ||
</code></pre> | ||
|
||
<h2>Literals</h2> | ||
<pre><code> | ||
"String Literal" | ||
'c' | ||
"""There is a double quote at the start of this string." | ||
"'c'" | ||
# "Comment, not String" | ||
"String, # Not Comment" | ||
@ | ||
</code></pre> | ||
|
||
<h2>Tokens</h2> | ||
<h3>Primitive Functions</h3> | ||
<pre><code> | ||
+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔! | ||
</code></pre> | ||
<h3>1-Operators</h3> | ||
<pre><code> | ||
˙˜˘¨⌜⁼´˝` | ||
</code></pre> | ||
<h3>2-Operators</h3> | ||
<pre><code> | ||
∘○⊸⟜⌾⊘◶⎉⚇⍟⎊ | ||
</code></pre> | ||
<h3>Special Names</h3> | ||
<pre><code> | ||
𝕨𝕩𝕗𝕘𝕤𝕎𝕏𝔽𝔾𝕊𝕣_𝕣 | ||
_𝕣_ | ||
</code></pre> | ||
<h3>Punctuation</h3> | ||
<pre><code> | ||
←⇐↩(){}⟨⟩[]‿·⋄,.;:? | ||
</code></pre> | ||
|
||
<h2>Words</h2> | ||
<h3>Numbers</h3> | ||
<pre><code> | ||
1464 | ||
3.14159 | ||
¯2 | ||
∞ | ||
π | ||
¯∞ | ||
2.8e¯4 | ||
1.618E2 | ||
</code></pre> | ||
<h3>Names</h3> | ||
<pre><code> | ||
VariableName | ||
ThereAre4Symbols_¯∞πAllowedInNames | ||
</code></pre> | ||
<h2>Namespaces</h2> | ||
<pre><code> | ||
example.b | ||
{n⇐7}.n | ||
</code></pre> | ||
<h2>System Functions</h2> | ||
<pre><code> | ||
•Function | ||
•function | ||
•_function_ | ||
@•Function@ | ||
+•Function+ | ||
˙•Function˙ | ||
∘•Function∘ | ||
𝕨•Function𝕩 | ||
←•Function? | ||
•Function_.¯∞πCanHaveSymbols | ||
•0.0.0.0 | ||
</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
#!/usr/bin/env bqn | ||
# Full Line Comment. The above is a shebang. | ||
+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔! # Comment at End of Line. | ||
'#' # The preceding should not be a comment. | ||
"BQN is #1" # The preceding should not be a comment. | ||
# Comments # Continue # To # The # EOL # | ||
######################################## | ||
Symbol | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["shebang", "#!/usr/bin/env bqn"], | ||
|
||
["comment", "# Full Line Comment. The above is a shebang."], | ||
|
||
["primitive-functions", "+"], | ||
["primitive-functions", "-"], | ||
["primitive-functions", "×"], | ||
["primitive-functions", "÷"], | ||
["primitive-functions", "⋆"], | ||
["primitive-functions", "√"], | ||
["primitive-functions", "⌊"], | ||
["primitive-functions", "⌈"], | ||
["primitive-functions", "|"], | ||
["primitive-functions", "¬"], | ||
["primitive-functions", "∧"], | ||
["primitive-functions", "∨"], | ||
["primitive-functions", "<"], | ||
["primitive-functions", ">"], | ||
["primitive-functions", "≠"], | ||
["primitive-functions", "="], | ||
["primitive-functions", "≤"], | ||
["primitive-functions", "≥"], | ||
["primitive-functions", "≡"], | ||
["primitive-functions", "≢"], | ||
["primitive-functions", "⊣"], | ||
["primitive-functions", "⊢"], | ||
["primitive-functions", "⥊"], | ||
["primitive-functions", "∾"], | ||
["primitive-functions", "≍"], | ||
["primitive-functions", "⋈"], | ||
["primitive-functions", "↑"], | ||
["primitive-functions", "↓"], | ||
["primitive-functions", "↕"], | ||
["primitive-functions", "«"], | ||
["primitive-functions", "»"], | ||
["primitive-functions", "⌽"], | ||
["primitive-functions", "⍉"], | ||
["primitive-functions", "/"], | ||
["primitive-functions", "⍋"], | ||
["primitive-functions", "⍒"], | ||
["primitive-functions", "⊏"], | ||
["primitive-functions", "⊑"], | ||
["primitive-functions", "⊐"], | ||
["primitive-functions", "⊒"], | ||
["primitive-functions", "∊"], | ||
["primitive-functions", "⍷"], | ||
["primitive-functions", "⊔"], | ||
["primitive-functions", "!"], | ||
["comment", "# Comment at End of Line."], | ||
|
||
["character-literal", "'#'"], | ||
["comment", "# The preceding should not be a comment."], | ||
|
||
["string-literal", "\"BQN is #1\""], | ||
["comment", "# The preceding should not be a comment."], | ||
|
||
["comment", "# Comments # Continue # To # The # EOL #"], | ||
|
||
["comment", "########################################"], | ||
|
||
["word-name", "Symbol"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Comments follow a '#' character only, on a single line, to the end of the | ||
line, unless in a shebang, character literal, or string literal. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
example.b | ||
{n⇐7}.n | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["dot-notation-on-name", "example."], | ||
["word-name", "b"], | ||
|
||
["dot-notation-on-brackets", "{"], | ||
["word-name", "n"], | ||
["punctuation", "⇐"], | ||
["word-number", "7"], | ||
["dot-notation-on-brackets", "}."], | ||
["word-name", "n"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
A namespace is a type of value that groups together several variables | ||
(fields) from the same scope. A block or file returns a namespace if it | ||
contains any export arrows ⇐ at the top level, and fields from namespaces can | ||
be accessed with either dot syntax or destructuring assignment. A namespace | ||
can be mutable only if any of its source code uses ↩ to change the value of a | ||
field. | ||
|
||
There are also two ways to get values out of a namespace, such as example | ||
defined above. First, one field at a time can be retrieved with dot syntax: | ||
write the namespace, then a dot ., then another name. | ||
|
||
The second, destructuring assignments, does not require special highlighting. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
"String Literal" | ||
'c' | ||
'not a string or character' | ||
""Not A String | ||
""Not A String"" | ||
"""There is a double quote at the start of this string." | ||
"'this is a string'" | ||
"'c'" | ||
# "Comment, not String" | ||
"String, # Not Comment" | ||
" | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["string-literal", "\"String Literal\""], | ||
|
||
["character-literal", "'c'"], | ||
|
||
"\r\n'", | ||
["word-name", "not"], | ||
["word-name", "a"], | ||
["word-name", "string"], | ||
["word-name", "or"], | ||
["word-name", "character"], | ||
"'\r\n", | ||
|
||
["string-literal", "\"\""], | ||
["word-name", "Not"], | ||
["word-name", "A"], | ||
["word-name", "String"], | ||
|
||
["string-literal", "\"\""], | ||
["word-name", "Not"], | ||
["word-name", "A"], | ||
["word-name", "String"], | ||
["string-literal", "\"\""], | ||
|
||
["string-literal", "\"\"\"There is a double quote at the start of this string.\""], | ||
|
||
["string-literal", "\"'this is a string'\""], | ||
|
||
["string-literal", "\"'c'\""], | ||
|
||
["comment", "# \"Comment, not String\""], | ||
|
||
["string-literal", "\"String, # Not Comment\""], | ||
|
||
"\r\n\"" | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Strings—lists of characters—are written with double quotes "", and characters | ||
with single quotes '' with a single character in between. Only one character | ||
ever needs to be escaped: a double quote in a string is written twice. So | ||
"""" is a one-character string of ", and if two string literals are next to | ||
each other, they have to be separated by a space. Character literals don't | ||
have even one escape, as the length is already known. Other than the double | ||
quote, character and string literals can contain any character directly: | ||
newlines, null characters, or other Unicode. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
•Function | ||
•function | ||
•_function_ | ||
@•Function@ | ||
+•Function+ | ||
˙•Function˙ | ||
∘•Function∘ | ||
𝕨•Function𝕩 | ||
←•Function? | ||
•Function_.¯∞πCanHaveSymbols | ||
•0.0.0.0 | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["function", "•Function"], | ||
|
||
["function", "•function"], | ||
|
||
["function", "•_function_"], | ||
|
||
["null-literal", "@"], | ||
["function", "•Function"], | ||
["null-literal", "@"], | ||
|
||
["primitive-functions", "+"], | ||
["function", "•Function"], | ||
["primitive-functions", "+"], | ||
|
||
["primitive-1-operators", "˙"], | ||
["function", "•Function"], | ||
["primitive-1-operators", "˙"], | ||
|
||
["primitive-2-operators", "∘"], | ||
["function", "•Function"], | ||
["primitive-2-operators", "∘"], | ||
|
||
["special-name", "𝕨"], | ||
["function", "•Function"], | ||
["special-name", "𝕩"], | ||
|
||
["punctuation", "←"], | ||
["function", "•Function"], | ||
["punctuation", "?"], | ||
|
||
["function", "•Function_.¯∞πCanHaveSymbols"], | ||
|
||
["function", "•0.0.0.0"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
System Functions should be identified regardless of what is next to them. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
@ | ||
+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔! | ||
˙˜˘¨⌜⁼´˝` | ||
∘○⊸⟜⌾⊘◶⎉⚇⍟⎊ | ||
𝕨𝕩𝕗𝕘𝕤𝕣𝕎𝕏𝔽𝔾𝕊 _𝕣 _𝕣_ | ||
←⇐↩(){}⟨⟩[]‿·⋄,.;:? | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["null-literal", "@"], | ||
|
||
["primitive-functions", "+"], | ||
["primitive-functions", "-"], | ||
["primitive-functions", "×"], | ||
["primitive-functions", "÷"], | ||
["primitive-functions", "⋆"], | ||
["primitive-functions", "√"], | ||
["primitive-functions", "⌊"], | ||
["primitive-functions", "⌈"], | ||
["primitive-functions", "|"], | ||
["primitive-functions", "¬"], | ||
["primitive-functions", "∧"], | ||
["primitive-functions", "∨"], | ||
["primitive-functions", "<"], | ||
["primitive-functions", ">"], | ||
["primitive-functions", "≠"], | ||
["primitive-functions", "="], | ||
["primitive-functions", "≤"], | ||
["primitive-functions", "≥"], | ||
["primitive-functions", "≡"], | ||
["primitive-functions", "≢"], | ||
["primitive-functions", "⊣"], | ||
["primitive-functions", "⊢"], | ||
["primitive-functions", "⥊"], | ||
["primitive-functions", "∾"], | ||
["primitive-functions", "≍"], | ||
["primitive-functions", "⋈"], | ||
["primitive-functions", "↑"], | ||
["primitive-functions", "↓"], | ||
["primitive-functions", "↕"], | ||
["primitive-functions", "«"], | ||
["primitive-functions", "»"], | ||
["primitive-functions", "⌽"], | ||
["primitive-functions", "⍉"], | ||
["primitive-functions", "/"], | ||
["primitive-functions", "⍋"], | ||
["primitive-functions", "⍒"], | ||
["primitive-functions", "⊏"], | ||
["primitive-functions", "⊑"], | ||
["primitive-functions", "⊐"], | ||
["primitive-functions", "⊒"], | ||
["primitive-functions", "∊"], | ||
["primitive-functions", "⍷"], | ||
["primitive-functions", "⊔"], | ||
["primitive-functions", "!"], | ||
|
||
["primitive-1-operators", "˙"], | ||
["primitive-1-operators", "˜"], | ||
["primitive-1-operators", "˘"], | ||
["primitive-1-operators", "¨"], | ||
["primitive-1-operators", "⌜"], | ||
["primitive-1-operators", "⁼"], | ||
["primitive-1-operators", "´"], | ||
["primitive-1-operators", "˝"], | ||
["primitive-1-operators", "`"], | ||
|
||
["primitive-2-operators", "∘"], | ||
["primitive-2-operators", "○"], | ||
["primitive-2-operators", "⊸"], | ||
["primitive-2-operators", "⟜"], | ||
["primitive-2-operators", "⌾"], | ||
["primitive-2-operators", "⊘"], | ||
["primitive-2-operators", "◶"], | ||
["primitive-2-operators", "⎉"], | ||
["primitive-2-operators", "⚇"], | ||
["primitive-2-operators", "⍟"], | ||
["primitive-2-operators", "⎊"], | ||
|
||
["special-name", "𝕨"], | ||
["special-name", "𝕩"], | ||
["special-name", "𝕗"], | ||
["special-name", "𝕘"], | ||
["special-name", "𝕤"], | ||
["special-name", "𝕣"], | ||
["special-name", "𝕎"], | ||
["special-name", "𝕏"], | ||
["special-name", "𝔽"], | ||
["special-name", "𝔾"], | ||
["special-name", "𝕊"], | ||
["special-name", "_𝕣"], | ||
["special-name", "_𝕣_"], | ||
|
||
["punctuation", "←"], | ||
["punctuation", "⇐"], | ||
["punctuation", "↩"], | ||
["punctuation", "("], | ||
["punctuation", ")"], | ||
["punctuation", "{"], | ||
["punctuation", "}"], | ||
["punctuation", "⟨"], | ||
["punctuation", "⟩"], | ||
["punctuation", "["], | ||
["punctuation", "]"], | ||
["punctuation", "‿"], | ||
["punctuation", "·"], | ||
["punctuation", "⋄"], | ||
["punctuation", ","], | ||
["punctuation", "."], | ||
["punctuation", ";"], | ||
["punctuation", ":"], | ||
["punctuation", "?"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
A test that all of the BQN primitive tokens are correctly identified, | ||
according to the spec at https://mlochbaum.github.io/BQN/spec/token.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
1464 | ||
1.618 | ||
1.314E1 | ||
∞ | ||
π | ||
2π | ||
¯∞ | ||
TheAboveAreNumbersNotNames | ||
ThereAre4Symbols_¯∞πAllowedInNames | ||
ThisIs.aNamespace | ||
•System_¯∞πFunction | ||
𝕣 | ||
_𝕣 | ||
_𝕣_ | ||
This𝕣IsNotASingleName | ||
|
||
---------------------------------------------------- | ||
|
||
[ | ||
["word-number", "1464"], | ||
["word-number", "1.618"], | ||
["word-number-scientific", "1.314E1"], | ||
["word-number", "∞"], | ||
["word-number", "π"], | ||
["word-number", "2"], | ||
["word-number", "π"], | ||
["word-number", "¯∞"], | ||
["word-name", "TheAboveAreNumbersNotNames"], | ||
["word-name", "ThereAre4Symbols_¯∞πAllowedInNames"], | ||
["dot-notation-on-name", "ThisIs."], | ||
["word-name", "aNamespace"], | ||
["function", "•System_¯∞πFunction"], | ||
["special-name", "𝕣"], | ||
["special-name", "_𝕣"], | ||
["special-name", "_𝕣_"], | ||
["word-name", "This"], | ||
["special-name", "𝕣"], | ||
["word-name", "IsNotASingleName"] | ||
] | ||
|
||
---------------------------------------------------- | ||
|
||
Numbers and variable names share a token formation rule, and are collectively | ||
called words. A word is a number if it starts with a digit or numeric | ||
character ¯∞π, and a name otherwise. | ||
|
||
Words are formed from digits, letters, and the characters _.¯∞π. All these | ||
characters stick together, so that you need to separate words with whitespace | ||
in order to write them next to each other. But . only counts if it's followed | ||
by a digit: otherwise it forms its own token to support namespace syntax | ||
ns.field. A word may be preceded by • to form a system name. | ||
|
||
The character 𝕣 also sticks with other word-forming characters, but is only | ||
allowed form the special names 𝕣, _𝕣, and _𝕣_. |