aboutsummaryrefslogtreecommitdiff
path: root/src/pr.bqn
blob: e930e6c64ebe41caabcf457cb095a6554d9da44d (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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env dbqn

# Process BQN runtime

impl  •LNS •path∾"r.bqn"

chrs
  "+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!"
  "˜˘¨⌜⁼´˝`"
  "∘○⊸⟜⌾⊘◶⎉⚇⍟"

nc  ¨chrs
chr  chrs
itr  0˜chr

init  " "¨(/"_"¨nc/011)¨(nc/"FMD")¨(nc+´↑⥊"ABC"•a)
post  " "¨/"_"¨nc/001
names  init¨(•UCS 48)¨post

Inc  {
  ichr𝕩
  n0  itr{n1+𝕩}(i⊑⊢)itr
  names((iinit)(•UCS 48+n)ipost)(i⊑⊢)names
}

# Required functionality passed in as an argument
pnam  "IsArray","Type","Log","GroupLen","GroupOrd"names˜chr"!+-×÷⋆⌊=≤≢⥊⊑↕⌜`"


E_isdef  (3≤≠)0,´chr," ","←↩"˜¨3
E_proc  {
  lchr
  q`𝕩"""'"  f¬∨`q¬𝕩='#'
   (((l×f/q)+chr) (l)names,¨ ) f/𝕩
}
E_redef  { # handles [fmd] [←↩]
  tail  E_proc 3𝕩 # must use old def
  Inc 𝕩
  (E_proc 1𝕩)  "←"  tail
}

ref   (•UCS 10)¨ 
  "{"
  "←𝕩"˜"⟨""⟩"˜1↓∾","¨pnam
  E_isdefE_procE_redef¨ impl∾<"⟨""⟩"˜1↓⥊","˘chrs
  "}"