aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-05 14:06:10 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2020-07-05 14:06:10 -0400
commit061721cfe5c39e1f499f675bd6fd7625d8fc9826 (patch)
tree93628596fe50fd1b66f53f406fade69e6a4a935a
parentf8ac1d8953e854cb0f50ee0ad1721280c5b9cbba (diff)
Use second UTF-16 surrogate character to represent double-struck chars
-rwxr-xr-xdc.bqn9
1 files changed, 5 insertions, 4 deletions
diff --git a/dc.bqn b/dc.bqn
index 657e2be3..0064b72d 100755
--- a/dc.bqn
+++ b/dc.bqn
@@ -5,7 +5,7 @@ charSet←∾charGroups←⟨
chF←"+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔" ⍝ Function
"˜˘¨⌜⁼´`" ⍝ Modifier
"∘○⊸⟜⌾⊘◶⎉⚇⍟" ⍝ Composition
- "𝕨𝕎𝕩𝕏𝕗𝔽𝕘𝔾" ⍝ Input
+ ¯1⊏˘10‿2⥊"𝕨𝕎𝕩𝕏𝕗𝔽𝕘𝔾𝕤𝕊" ⍝ Input (𝕣 pending; ℝ not allowed)
nl∾"⋄," ⍝ Separator
"←↩→" ⍝ Gets
"(){}⟨⟩" ⍝ Bracket
@@ -13,10 +13,11 @@ charSet←∾charGroups←⟨
•d ⍝ +⟜(↕10)⌾•UCS'0' ⍝ Digit
"¯.π∞" ⍝ Numeric
"_"∾' '(⊢∾+)⌾•UCS•a ⍝ Alphabetic
+ 1↑"𝕨" ⍝ Prefix for input (hack around UTF-16)
" "∾tab ⍝ Whitespace
⍝ ⍝'" eliminated during tokenization
-bF‿bM‿bC‿bI‿bS‿bG‿bB‿bL‿bD‿bN‿bA‿bW←⊔/≠¨charGroups
+bF‿bM‿bC‿bI‿bS‿bG‿bB‿bL‿bD‿bN‿bA‿bP‿bW←⊔/≠¨charGroups
vi←+´≠¨8↑charGroups
Tokenize←{
@@ -33,7 +34,7 @@ Tokenize←{
w←(≠↑0∾⊢)⊸<l←c∊∾bD‿bN‿bA
id←⍷args∾(bA∊˜w/c)⍒⊸⊏i←(1-˜l×+`w)⊔c
nv←+´bA∊˜⊑¨id
- c↩(w∨¬l∨c∊bW)/(vi+id⊐i)⌾(w⊸/)(vi+(≠id)+lu⊐lit)⌾(cl⊸/)c
+ c↩(w∨¬l∨c∊bP∾bW)/(vi+id⊐i)⌾(w⊸/)(vi+(≠id)+lu⊐lit)⌾(cl⊸/)c
c/˜↩¬(1⌾⊑1⌽1⌾⊑)⊸∧c∊bS
⟨c,nv,nv-≠args,(nv↓id)∾lu⟩
}
@@ -112,5 +113,5 @@ or←⟨"w","x"⟩ GenFn "(w+x)-w∧x"
Compile←{
body←GenFn 𝕩
f←⟨rcp,or,body⟩
- Gen ⟨(≠¨f)/⟨1‿1,2‿1,0‿1⟩⥊¨¨f64 ⋄ 2 ⋄ ∾f⟩
+ Gen ⟨(≠¨f)/(1‿2‿0∾¨1)⥊¨¨f64 ⋄ 2 ⋄ ∾f⟩
}