From fcd6f3feb1d12e4a1ec271e560ebe804f4ae5d68 Mon Sep 17 00:00:00 2001 From: Marshall Lochbaum Date: Wed, 14 Oct 2020 16:01:03 -0400 Subject: =?UTF-8?q?Move=20from=20=E2=80=A2EX=20to=20=E2=80=A2Import?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dc.bqn | 8 ++++---- md.bqn | 4 ++-- running.md | 4 ++-- src/cjs.bqn | 4 ++-- src/pr.bqn | 4 ++-- test/dz_comp | 2 +- test/dz_rt | 2 +- wc.bqn | 2 +- wcshim.bqn | 2 +- 9 files changed, 16 insertions(+), 16 deletions(-) diff --git a/dc.bqn b/dc.bqn index 336d7f66..c09e23a4 100755 --- a/dc.bqn +++ b/dc.bqn @@ -4,15 +4,15 @@ # 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"){𝔽} "⟨ +compile ← •Import •path∾"src/c.bqn" +prims ← (•Import •path∾"dzref"){𝔽} "⟨ +,-,×,÷,⋆,√,⌊,⌈,|,¬,∧,∨,<,>,≠,=,≤,≥,≡,≢,⊣,⊢,⥊,∾,≍,↑,↓,↕,«,»,⌽,⍉,/,⍋,⍒,⊏,⊑,⊐,⊒,∊,⍷,⊔,! ˙,˜,˘,¨,⌜,⁼,´,˝,` ∘,○,⊸,⟜,⌾,⊘,◶,⎉,⚇,⍟ ⟩" special←<˘∘‿2⥊"𝕤𝕩𝕨𝕣𝕗𝕘" -DCompile←{ +DCompile⇐{ ⟨bc,o,fblk⟩ ← prims Compile 𝕩 blk‿bdy ← <˘⍉>(↕≠fblk){ ⟨t,i,l,n⟩←𝕩 @@ -21,4 +21,4 @@ DCompile←{ }¨fblk ⟨bc,o,blk,bdy⟩ } -DRun←•COMP∘DCompile +DRun⇐•COMP∘DCompile diff --git a/md.bqn b/md.bqn index fef35ee0..16d14491 100644 --- a/md.bqn +++ b/md.bqn @@ -173,7 +173,7 @@ blobURL ← repoURL∾"/blob/master/" # Environments _getCodeExec ← {𝕗⋄⍎} -_getSvgExec ← {𝕗⋄⟨•path∾"svg.bqn","⍎"⟩ •EX •path∾"dzref"} +_getSvgExec ← {𝕗⋄⟨•path∾"svg.bqn","⍎"⟩ •Import •path∾"dzref"} ################################ @@ -632,7 +632,7 @@ GetMultiHighlights ← { ################################ # Format an array to a character matrix # Won't work on functions until we can catch errors -fmtm ← ⟨•path∾"src/fmt.bqn"⟩ •EX •path∾"dzref" +fmtm ← ⟨•path∾"src/fmt.bqn"⟩ •Import •path∾"dzref" Fmt ← ⍕ _fmtm diff --git a/running.md b/running.md index e0fce133..0690ad6b 100644 --- a/running.md +++ b/running.md @@ -22,13 +22,13 @@ All versions have automated tests in the [test](test/) directory, with the self- This repository contains a dzaima/BQN script `dzref` that fills in the gaps in primitive support using BQN implementations of primitives that are not yet up to spec ([reference implementations](spec/reference.bqn) of all primitives starting from a small set of pre-existing functions are part of BQN's specification). -You can run `dzref` from ordinary dzaima/BQN using the `•EX` command; see for example [wcshim.bqn](wcshim.bqn). For testing, it is run as a Unix script, in which case it depends on an executable `dbqn` that runs dzaima/BQN on a file argument. I use the following script, using the path to a clone of dzaima/BQN for the jar file. +You can run `dzref` from ordinary dzaima/BQN using the `•Import` command; see for example [wcshim.bqn](wcshim.bqn). For testing, it is run as a Unix script, in which case it depends on an executable `dbqn` that runs dzaima/BQN on a file argument. I use the following script, using the path to a clone of dzaima/BQN for the jar file. #! /bin/bash java -jar /path/to/dzaima/BQN/BQN.jar -f "$@" -The left argument for `•EX` or the shell arguments can contain up to two arguments for the script. The first is a file to run, and the second is BQN code to be run after it. +The left argument for `•Import` or the shell arguments can contain up to two arguments for the script. The first is a file to run, and the second is BQN code to be run after it. ### BQN2NGN diff --git a/src/cjs.bqn b/src/cjs.bqn index fc9db6f1..b481cdc0 100755 --- a/src/cjs.bqn +++ b/src/cjs.bqn @@ -1,6 +1,6 @@ #! /usr/bin/env dbqn -compile ← •EX •path∾"c.bqn" +compile ← •Import •path∾"c.bqn" Comp ← ((<"runtime["∾⍕∾"]"˙)¨↕62)⊸Compile FP ← ∞⊸=◶⟨⍕,"Infinity"⟩ Esc ← (⟨"\t","\n","\r","\'","\"""⟩∾<∘⥊)⊑˜("'"""∾˜@+9‿10‿13)⊑∘⊐⊢ @@ -13,7 +13,7 @@ Fout ← ⟨⊢,Fconst,L⟩ {L𝕎¨𝕩}¨ ⊢ Frun ← ("provide.concat("∾∾⟜")")⌾(1⊸⊑) Fout Long ← ∾ (1‿2/⟨" new Uint8Array("∾∾⟜")"⋄((@+10)∾" ,")⊸∾⟩) {𝕎𝕩}¨ ⊢ • ← (⊑"r"‿"c"‿"fmt"⊐⊏)◶⟨ - {𝕩⋄Long Frun {𝕩⊸↓⌾(1⊸⊑)Comp𝕨}´ •EX •path∾"pr.bqn"} + {𝕩⋄ref‿len←•Import•path∾"pr.bqn"⋄Long Frun len⊸↓⌾(1⊸⊑)Comp ref} {𝕩⋄Long Fout Comp J •LNS •path∾"c.bqn"} {𝕩⋄Long Fout Comp J •LNS •path∾"fmt.bqn"} ¯1 ↓ · J L∘Fout∘Comp¨ diff --git a/src/pr.bqn b/src/pr.bqn index e028cbc5..77d664ff 100755 --- a/src/pr.bqn +++ b/src/pr.bqn @@ -26,6 +26,7 @@ Inc ← { # Required functionality passed in as an argument def ← ⟨"IsArray","Type","Log","GroupLen","GroupOrd"⟩ keep ← "!+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘" +len ⇐ def+○≠keep ki ← chr⊐keep kt ← (+`nc)(∾((≠def)∾¯1↓⊣)+⊔⟜⊒∘⍋)ki names ↩ (⥊¨kt⊏chr)⌾(ki⊸⊏)names @@ -43,5 +44,4 @@ E_redef ← { # handles [fmd] [←↩] (E_proc 1↑𝕩) ∾ "←" ∾ tail } -ref ← ∾∾⟜(@+10)¨ E_isdef◶E_proc‿E_redef¨ impl∾<"⟨"∾"⟩"∾˜1↓⥊","⊸∾˘chr -⟨ref, def+○≠keep⟩ +ref ⇐ ∾∾⟜(@+10)¨ E_isdef◶E_proc‿E_redef¨ impl∾<"⟨"∾"⟩"∾˜1↓⥊","⊸∾˘chr diff --git a/test/dz_comp b/test/dz_comp index 52dbcc51..73806102 100755 --- a/test/dz_comp +++ b/test/dz_comp @@ -1,6 +1,6 @@ #! /usr/bin/env dbqn -dRun ← •EX •path∾"../dc.bqn" +⟨DRun⟩ ← •Import •path∾"../dc.bqn" c ← ∾(•LNS •path∾∾⟜"cases.bqn")¨""‿"b" {𝕩: c ∾↩ (¬":"⊑∘∊⊢)¨⊸/ "1 %"⊸∾¨ (3≤≠)◶0‿(('#'≠2⊸⊑)∧" "≡2⊸↑)¨⊸/ •LNS •path∾"prim.bqn" }⍟⊢⊑(<"-prim")∊•args M ← {e‿b: (⍎e)⊸≢◶""‿{(@+10)∾˜""""∾b∾""": expected "∾e∾" but received "∾⍕𝕩} DRun b} diff --git a/test/dz_rt b/test/dz_rt index 8572d441..06d08adb 100755 --- a/test/dz_rt +++ b/test/dz_rt @@ -4,7 +4,7 @@ impl ← •LNS •path∾"../src/r.bqn" -drun ← •EX •path∾"../dc.bqn" +⟨DRun⟩ ← •Import •path∾"../dc.bqn" chrs←⟨ "!+-×÷⋆√⌊⌈∧∨¬|=≠≤<>≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔" diff --git a/wc.bqn b/wc.bqn index b99ce059..e8ca8c6a 100644 --- a/wc.bqn +++ b/wc.bqn @@ -3,7 +3,7 @@ # WebAssembly backend (very incomplete) i←"⟨cgl,charSet,Tokenize⟩" -⟨cgl,charSet,Tokenize⟩ ← ⟨•path∾"src/c.bqn",i⟩ •EX •path∾"dzref" +⟨cgl,charSet,Tokenize⟩ ← ⟨•path∾"src/c.bqn",i⟩ •Import •path∾"dzref" chF←(⊑cgl)↑charSet bF‿bM‿bC‿bS‿bG‿bB‿bL‿bO‿bI‿bU‿bD‿bN‿bA‿bW←≍¨˜⟜(+`≠↑0∾⊢)cgl M←1⊸⊑(0⊸≤∧>)-⟜⊑ diff --git a/wcshim.bqn b/wcshim.bqn index 97b85cfd..2ae4aac8 100755 --- a/wcshim.bqn +++ b/wcshim.bqn @@ -1,3 +1,3 @@ #! /usr/bin/env dbqn -((<•path∾"wc.bqn")∾•args) •EX •path∾"dzref" +((<•path∾"wc.bqn")∾•args) •Import •path∾"dzref" -- cgit v1.2.3