aboutsummaryrefslogtreecommitdiff
path: root/src/pr.bqn
blob: d8d1c8e6139a9b297228631fe163d912fbbba264 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/usr/bin/env dbqn

# Process BQN runtime
rtt  ('0'-˜)=  •args∾2   # Runtime type: 0, 1, or all
rtn  2 rtt # File numbers included

glyphs  •Import "glyphs.bqn"

# Provided values, to be passed in through the constants array
aliasdef  (¨ < 1¨) "?Type","∩Fill","⍣Log",
                           "$GroupLen","%GroupOrd","⍝_fillBy_"
keep  "!+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘⎊"
chrext  glyphs ¨ ((+´·`'_'=0¯1)¨def)  alias

inout  rtt  {
  in0out0  "∩⍝+-×⌊=≤≢⥊⊑↕⌜", "⌊⌈|<>≠≥⊢⊣∾↑↓⊏˙˜´∘○⊸⟜◶⍟"
  in1   out0 ˜ in2  aliaskeep
  out2  glyphs
   in0out0, in1out2, in2out2 
}

need  chrext((+`¨)⊣⍋∾) in

GetRepls  { cn𝕩  c,c((c∊⥊¨in)/)n¨def,¨alias }

E_proc  glyphsGetRepls •Import "pp.bqn"

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