aboutsummaryrefslogtreecommitdiff
path: root/dc.bqn
blob: 66e6b6207d5fe6c61156e1c18edb0a13c6aca532 (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
#! /usr/bin/env dbqn

# dzaima/BQN block headers are a little different from the version used
# in the Javascript implementation:
# - Types are f/m/d instead of 0/1/2
# - dzaima/BQN uses variable names instead of counts (but we make the
#   names up anyway, except for special names).

compile  •EX •path∾"src/c.bqn"
prims  (•EX •path∾"dzref"){𝔽} "⟨
  +,-,×,÷,⋆,√,⌊,⌈,|,¬,∧,∨,<,>,≠,=,≤,≥,≡,≢,⊣,⊢,⥊,∾,≍,↑,↓,↕,«,»,⌽,⍉,/,⍋,⍒,⊏,⊑,⊐,⊒,∊,⍷,⊔,!
  ˙,˜,˘,¨,⌜,⁼,´,˝,`
  ∘,○,⊸,⟜,⌾,⊘,◶,⎉,⚇,⍟
⟩"

special<˘2"𝕤𝕩𝕨𝕣𝕗𝕘"
DCompile{
  bc,o,blk  prims Compile 𝕩
  blk  {
    t,i,l,n𝕩
    s(3×i)(t356)special
    t,i,l,s∾⥊¨'a'+↕n-≠s
  }¨blk
  bc,o,⟨⟩,blk
}
DRun•COMPDCompile