blob: 29337498353466a2b86e1744e8f3f8773f1b23bb (
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
|
#!/usr/bin/env dbqn
# Process BQN runtime
# All primitives
chrs←•Import "glyphs.bqn"
glyphs ← ∾chrs
# Provided values, to be passed in through the constants array
alias‿def ← (⊑¨ ≍○< 1⊸↓¨) ⟨"?Type","∩Fill","⍣Log",
"$GroupLen","%GroupOrd","⍝_fillBy_"⟩
keep ← "!+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘⎊"
type ← ((+´·∧`'_'=0‿¯1⊸⊏)¨def) ∾ chrs((+`≠¨)∘⊣⍋∾⊸⊐)keep
prims ⇐ type ⊔ alias∾keep
GetRepls ← {
c‿n ← 𝕩
ki ← (⊑¨c)⊐keep
⟨c,c⊣⌾(ki⊸⊏)n⟩∾¨⟨def,⥊¨alias⟩
}
⟨E_proc⟩ ← chrs‿GetRepls •Import "pp.bqn"
gd ← "glyphs←"""∾glyphs∾"%"""
rslt ← "⟨"∾"⟩"«∾","⊸∾¨glyphs # Output all primitives
src ← ∾⟨⟨gd⟩,•FLines"r.bqn",⟨"{PrimInd↩⊑𝕩⊐<⋄𝕩‿SetPrims}"∾rslt⟩⟩
ref ⇐ ∾∾⟜(@+10)¨ E_proc¨ src
|