diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-07-26 18:17:08 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2020-07-26 18:17:08 -0400 |
| commit | fc59f7b12a80552fd1088561e05eb3ed48fead6a (patch) | |
| tree | 7930323bd35fa1c4b81867ced90e11aeed62bae5 | |
| parent | ce937d8768405dbf2e8ccbc1d7361a8db05d4e5b (diff) | |
Update bytecode format to add special name declarations
| -rwxr-xr-x | c.bqn | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -10,7 +10,7 @@ charSet←∾charGroups←⟨ "(){}⟨⟩" # Bracket "‿" # Ligature "·" # nOthing - ¯1⊏˘10‿2⥊"𝕎𝕏𝕊𝔽𝔾𝕨𝕩𝕤𝕗𝕘" # Input (𝕣 pending; ℝ not allowed) + ¯1⊏˘10‿2⥊"𝕊𝕏𝕎𝔽𝔾𝕤𝕩𝕨𝕗𝕘" # Input (𝕣 pending; ℝ not allowed) •d # +⟜(↕10)⌾•UCS'0' # Digit "¯.π∞" # Numeric "_"∾˜' '(+∾⊢)⌾•UCS•a # Alphabetic @@ -21,6 +21,8 @@ charSet←∾charGroups←⟨ bF‿bM‿bC‿bS‿bG‿bB‿bL‿bO‿bI‿bD‿bN‿bA‿bP‿bW←⊔/≠¨charGroups vi←+´≠¨9↑charGroups charRole←((vi-≠bI)↑/0∾≠¨3↑charGroups)∾(5/⌽↕2)∾0 +special←<˘6‿2⥊"𝕤𝕩𝕨𝕣𝕗𝕘" +spd←⥊⍉3‿0↓⌜↑⟜special⌜3‿5‿6 Tokenize←{ r←𝕩='#'⋄s←/(≠↑2⊸↓)⊸∧𝕩='''⋄d←/𝕩='"' @@ -154,8 +156,8 @@ DParse ← {nv‿r𝕊𝕩: rev⊏˜↩⍋{+`⌾((⍋+`𝕩)⊸⊏)𝕩>0}rev⊏br bv←rev⊏br⋄b←/be←bv<0 H←<˝∘⍉2↕(1∾˜bv>0)/·+`0∾˜(rev⊏𝕩)∊(5⊑bI)+⊢ - ft←(H↕3)+2×(H⥊3)⌈2×H⥊4 - r↩(ft⊏(1+2⊸≤)⊸/↕4)⌾((be/rev)⊸⊏)r + ft←0∾(H↕3)+2×(H⥊3)⌈2×H⥊4 + r↩((1↓ft)⊏(1+2⊸≤)⊸/↕4)⌾((be/rev)⊸⊏)r g↩⍋+`rev⊏p-br⋄gr←g⊏rev⋄sll←1+2÷˜0(<-○/>)gr⊏sr-sl⋄l←/gr⊏𝕩=5⊑bB g⊏˜↩gs←⍋gr⊏sl⋄gr↩g⊏rev⋄𝕩⊏˜↩gr⋄r⊏˜↩gr⋄o⊏˜↩gr⋄si←/gr⊏sr>sl⋄b⊏↩⍋g⋄l⊏↩⍋gs @@ -170,9 +172,9 @@ DParse ← {nv‿r𝕊𝕩: lo←(o/𝕩)=4⊑bB⋄ll←1+lo/1(↓--⊸↓)(o∾1)/+`(s∾0)-(1∾o)∧ps∾1 dr←/s>o+`⊸⊏0∾lo⋄rt←/𝕩=2⊑bB or←⍋g⊏˜∾⟨cn,cn,id,id,b,b,rt,1+/a,dr,l,l,si,si,oa+1⌈oa⊏os,(dy×⊏⟜os)⊸+fa+dy⟩ - bc1←⟨0¨cn,u⊐ob,1+(id-1)⊏a,5+vi-˜id⊏𝕩,15¨b,1+↕≠b⟩ + bc1←⟨0¨cn,u⊐ob,1+(id-1)⊏a,-⟜(3⊸≥)(≠special)+vi-˜id⊏𝕩,15¨b,1+↕≠b⟩ bc←or⊏∾bc1∾⟨25¨rt,(11-⊑bG)+a/𝕩,14¨dr,3¨l,ll,3¨si,sll,5+oa⊏r,5+dy+4×fa⊏tr⟩ - ⟨LEBv bc,u,((0∾ft)⊏⥊"fmd"≍⌜⌽↕2)∾¨/1∾or∊(+´≠¨bc1)+↕≠rt⟩ + ⟨LEBv bc,u,(ft⊏⥊"fmd"≍⌜⌽↕2)∾¨(ft⊏spd)<∘≍˘˜/1∾or∊(+´≠¨bc1)+↕≠rt⟩ } prims←⟨ @@ -184,7 +186,7 @@ DGenFn←{ ⟨t,r,nVar,lits⟩←Tokenize𝕩 ⟨bc,u,blk⟩←nVar‿r DParse t o←(u-(vi+nVar-≠prims)×u≥vi)⊏prims∾LitVal¨lits - ⟨bc,o,(<˘5‿2⥊"𝕨𝕩𝕤𝕗𝕘")∾⥊¨nVar↑•a,blk⟩ + ⟨bc,o,special∾⥊¨nVar↑•a,blk⟩ } DRun←{ •COMP DGenFn 𝕩 |
