diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-28 16:00:43 -0400 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2021-04-28 16:00:43 -0400 |
| commit | 382dddfbdd49cc176744ec00ba57e5787cd94620 (patch) | |
| tree | 13657874ded871c882f09d8d949dfc457e082eb4 /src | |
| parent | 038066e41e654b1288939a38af6da9329a26f4bf (diff) | |
Allow pr.bqn to emit a half runtime with •args 0 or 1
Diffstat (limited to 'src')
| -rwxr-xr-x | src/pr.bqn | 33 |
1 files changed, 18 insertions, 15 deletions
@@ -1,29 +1,32 @@ #!/usr/bin/env dbqn # Process BQN runtime +rtt ← ('0'-˜⊑)⍟= ⊑ •args∾2 # Runtime type: 0, 1, or all +rtn ← 2⊸≤◶⥊‿↕ rtt # File numbers included -# All primitives -chrs←•Import "glyphs.bqn" -glyphs ← ∾chrs +glyphs ← •Import "glyphs.bqn" # Provided values, to be passed in through the constants array alias‿def ← (⊑¨ ≍○< 1⊸↓¨) ⟨"?Type","∩Fill","⍣Log", "$GroupLen","%GroupOrd","⍝_fillBy_"⟩ keep ← "!+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘⎊" +chrext ← glyphs ∾¨ ((+´·∧`'_'=0‿¯1⊸⊏)¨def) ⊔ alias -type ← ((+´·∧`'_'=0‿¯1⊸⊏)¨def) ∾ chrs((+`≠¨)∘⊣⍋∾⊸⊐)keep -need ⇐ type ⊔ alias∾keep - -GetRepls ← { - c‿n ← 𝕩 - ki ← (⊑¨c)⊐keep - ⟨c,c⊣⌾(ki⊸⊏)n⟩∾¨⟨def,⥊¨alias⟩ +in‿out ← rtt ⊑ { + in0‿out0 ← ⟨"∩⍝+-×⌊=≤≢⥊⊑↕⌜", "⌊⌈|<>≠≥⊢⊣∾↑↓⊏˙˜´∘○⊸⟜◶⍟"⟩ + in1 ← ⍷ out0 ∾˜ in2 ← alias∾keep + out2 ← ∾glyphs + ⟨ in0‿out0, in1‿out2, in2‿out2 ⟩ } -⟨E_proc⟩ ← chrs‿GetRepls •Import "pp.bqn" +need ⇐ chrext⊸((+`≠¨)∘⊣⍋∾⊸⊐)⊸⊔ in + +GetRepls ← { c‿n←𝕩 ⋄ ⟨c,c⊣⌾((c∊⥊¨in)⊸/)n⟩∾¨⟨def,⥊¨alias⟩ } + +⟨E_proc⟩ ← glyphs‿GetRepls •Import "pp.bqn" -gd ← "glyphs←"""∾glyphs∾"%""" -rslt ← "⟨"∾"⟩"«∾","⊸∾¨glyphs # Output all primitives -rr ← •FLines¨ "r0.bqn"‿"r1.bqn" -raw ← ∾⟨⟨gd⟩,∾rr,⟨"{PrimInd↩⊑𝕩⊐<⋄𝕩‿SetPrims}"∾rslt⟩⟩ +rslt ← "⟨"∾"⟩"«∾","⊸∾¨out # Output all primitives +raw ← ∾ (•FLines "r"∾'0'⊸+∾".bqn"˙)¨ rtn +{𝕤⋄ raw∾˜↩⟨"glyphs←"""∾out∾"%"""⟩ ⋄ rslt∾˜↩"{PrimInd↩⊑𝕩⊐<⋄𝕩‿SetPrims}"}⍟⊢ ∨´1=rtn +raw ∾↩ ⟨rslt⟩ src ⇐ ∾∾⟜(@+10)¨ E_proc¨ raw |
