aboutsummaryrefslogtreecommitdiff
path: root/dc.bqn
diff options
context:
space:
mode:
Diffstat (limited to 'dc.bqn')
-rwxr-xr-xdc.bqn13
1 files changed, 11 insertions, 2 deletions
diff --git a/dc.bqn b/dc.bqn
index 02e9deec..51085b28 100755
--- a/dc.bqn
+++ b/dc.bqn
@@ -11,14 +11,23 @@ prims ← (•Import "dzref"){𝔽} "⟨
∘,○,⊸,⟜,⌾,⊘,◶,⎉,⚇,⍟
⟩"
+LEB←{
+ b←128
+ s←+`»i←1+l←⌊b⋆⁼1⌈𝕩
+ o←⍋⍋↕∘≠⊸-i/s
+ v←o⊏l{f←×𝕨⋄(𝕨-1)(b⊸(×⟜f+|)∾𝕊⟜(⌊÷⟜b)○(f⊸/))⍟(∨´f)𝕩}𝕩
+ v‿s‿i
+}
+
special←<˘∘‿2⥊"𝕤𝕩𝕨𝕣𝕗𝕘"
DCompile⇐{
⟨bc,o,fblk,ind⟩ ← 4 ↑ prims Compile 𝕩
+ bcl‿el‿ol←LEB bc
blk‿bdy ← <˘⍉>(↕≠fblk){
⟨t,i,l,n⟩←𝕩
s←(3×i)↓(t⊑3‿5‿6)↑special
- ⟨⟨t,i,𝕨,𝕨⟩ ⋄ ⟨l, s∾⥊¨'a'+↕n-≠s⟩⟩
+ ⟨⟨t,i,𝕨,𝕨⟩ ⋄ ⟨l⊑el, s∾⥊¨'a'+↕n-≠s⟩⟩
}¨fblk
- ⟨bc,o,blk,bdy,⊑ind,1⊑ind,𝕩⟩
+ ⟨bcl,o,blk,bdy,ol/⊑ind,ol/1⊑ind,𝕩⟩
}
DRun⇐•COMP∘DCompile