From 7c388daec05b65a810aae6917ae28a9c9b910254 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 14 Oct 2020 15:16:30 -0400 Subject: Change dc.bqn to match new dzaima/BQN header format --- dc.bqn | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/dc.bqn b/dc.bqn index 66e6b620..336d7f66 100755 --- a/dc.bqn +++ b/dc.bqn @@ -1,10 +1,8 @@ #! /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). +# 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 ← •EX •path∾"src/c.bqn" prims ← (•EX •path∾"dzref"){𝔽} "⟨ @@ -15,12 +13,12 @@ prims ← (•EX •path∾"dzref"){𝔽} "⟨ special←<˘∘‿2⥊"𝕤𝕩𝕨𝕣𝕗𝕘" DCompile←{ - ⟨bc,o,blk⟩ ← prims Compile 𝕩 - blk ↩ { + ⟨bc,o,fblk⟩ ← prims Compile 𝕩 + blk‿bdy ← <˘⍉>(↕≠fblk){ ⟨t,i,l,n⟩←𝕩 s←(3×i)↓(t⊑3‿5‿6)↑special - ⟨t,i,l,s∾⥊¨'a'+↕n-≠s⟩ - }¨blk - ⟨bc,o,⟨⟩,blk⟩ + ⟨⟨t,i,𝕨,𝕨⟩ ⋄ ⟨l, s∾⥊¨'a'+↕n-≠s⟩⟩ + }¨fblk + ⟨bc,o,blk,bdy⟩ } DRun←•COMP∘DCompile -- cgit v1.2.3