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

# dzaima/BQN block headers have a different format to account for
# multiple bodies, and use variable names instead of counts.
# Rearrange and make up some names so the bytecode can be run.

compile  •Import "src/c.bqn"
prims  
  +,-,×,÷,,,,,|,¬,,,<,>,,=,,,,,,,,,,,,,«,»,,,/,,,,,,,,,,!
  ˙,˜,˘,¨,,,´,˝,`
  ,,,,,,,,,


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