From ff5c390e759c76728e14b104eb60a218384589cb Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Mon, 12 Jul 2021 17:30:38 -0400 Subject: =?UTF-8?q?Support=20two=20lists=20of=20function=20start=20indices?= =?UTF-8?q?;=20use=20for=20deferred=20blocks=20that=20require=20?= =?UTF-8?q?=F0=9D=95=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/c.bqn | 5 ++--- src/cjs.bqn | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/c.bqn b/src/c.bqn index dcbc5c27..e95e79d1 100644 --- a/src/c.bqn +++ b/src/c.bqn @@ -248,8 +248,6 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn fl←(dy×⊏⟜os)⊸+fa+dy # Function application site dr∾↩((1+dy)×fn←2=fm←fa⊏ne)/fl # Turn function applications on · to drops fn↩¬fn⋄fa/˜↩fn⋄fl/˜↩fn # And remove them - idor∾˜↩5/1+g⊏˜fw/¯1∾rt - idbc∾˜↩(+´fw)⥊⟨21‿0‿2‿18‿14⟩ # Bytecode generation: numbers bc ordered by source location (after rev) oi or←⍋oi←idor∾g⊏˜∾⟨cn,cn,bk,bk,2/l,dr,af/at,al+1,al+1,oa+1⌈oa⊏os,fl,rt⟩ @@ -260,7 +258,8 @@ Parse ← {r‿vn‿i‿e‿def←𝕨⋄nv←≠vn MI←-⊸↓˜⟜≠∾g⊏˜⊢⋄oj←(rt-∘≠⊸⌽oi⌊1-˜≠i)Mi∾⟨1-˜af/at,oa,fa⟩ ind←⟨oj,oj Mi fa⊏IT»¬ro∨ma⟩(¯1∾˜or⊏(≠rt)⊸⌽)⊸⊏¨i‿e # Function metadata and overall output - ⟨bc∾¯1⊑rc,u,⟨ft,¬fx,/1∾or≥bc-○≠rt,fsc+≠¨dn,dn,dx⟩,ind⟩ + fs←fw↑∘⥊⍟⊣¨⌾(fx⊸/)/1∾or≥bc-○≠rt # Function start indices + ⟨bc∾¯1⊑rc,u,⟨ft,¬fx,fs,fsc+≠¨dn,dn,dx⟩,ind⟩ } Compile←{ diff --git a/src/cjs.bqn b/src/cjs.bqn index d422d873..906fa55d 100755 --- a/src/cjs.bqn +++ b/src/cjs.bqn @@ -1,7 +1,7 @@ #! /usr/bin/env bqn # Javascript/JSON formatting -L ← "["∾"]"∾˜1↓·∾","⊸∾¨ # Native list/array +L ← "["∾"]"∾˜(0<≠)◶⟨"",1↓·∾","⊸∾¨⟩ # Native list/array Ind ← {∾𝕨‿"["‿𝕩‿"]"} # Native list/array indexing Cat ← {∾𝕨‿".concat("‿𝕩‿")"} # Native list/array concatenation (like ∾) # Escape the special characters that appear in BQN sources. @@ -24,7 +24,7 @@ useInd ← "-i"≡⊑args←•args ⋄ args↓˜↩useInd Comp ← ((<"runtime" Ind F)¨↕62) glyphs _getComp ⊢ J ← ∾∾⟜(@+10)¨ Fconst ← ≡◶⟨@⊸≤◶Num‿Char, Str, ⊑⟩ -Fout ← (≠↑⟨F,Fconst,L ·F¨4⊸↑,F⟩˙) {L𝕎¨𝕩}¨ ⊢ +Fout ← (≠↑⟨F,Fconst,L ·=◶⟨F,L(L F¨)¨⟩¨4⊸↑,F⟩˙) {L𝕎¨𝕩}¨ ⊢ Long ← ∾ (≠↑1‿3/⟨" "⊸∾⋄((@+10)∾" ,")⊸∾⟩˙) {𝕎𝕩}¨ ⊢ LFC ← Long∘Fout∘Comp -- cgit v1.2.3