diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-11-21 11:31:49 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-11-21 11:31:49 -0500 |
| commit | 3ea7eb8d18be52a989285e1a659be6ab76cc02b4 (patch) | |
| tree | adc6d77c137f36a7e1e983524b3116a3bf0f938e /dc.bqn | |
| parent | bac1b187aae5b524b98f0f70223d3b1d02175a80 (diff) | |
Stop encoding bytecode with LEB128; that can be done later for serialization
Diffstat (limited to 'dc.bqn')
| -rwxr-xr-x | dc.bqn | 13 |
1 files changed, 11 insertions, 2 deletions
@@ -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 |
