aboutsummaryrefslogtreecommitdiff
path: root/src/pr.bqn
blob: 983f2649a5242b96bb2bcee89818f4a97567d544 (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 bqn

# 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
Typ  chrext((+`¨)⊣⍋∾)

in0out0  "∩⍝+-×⌊=≤≢⥊⊑↕⌜⊘", "⌊⌈|<>≠≥⊢⊣∾⋈↑↓⊏˙˜¨´∘○⊸⟜◶⍟"
in2  aliaskeep
out2  glyphs
inout  rtt  in0,out0⟩‿⟨in2out0,out2⟩‿⟨in2,out2

inputs  out0, (⍋Typ)in2
need  Typ in

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

E_proc  glyphsGetRepls •Import "pp.bqn"

rslt  "⟨""⟩"«∾","¨out  # Output all primitives
raw  (•FChars "r"'0'+∾".bqn"˙)¨ rtn
{𝕤 raw˜"glyphs←"""out"%"""  rslt˜"{PrimInd↩⊑𝕩⊐<⋄𝕩‿SetPrims‿SetInv}"} ´1=rtn
raw  rslt
src  E_proc ∾∾(@+10)¨ raw