aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/cjs.bqn17
-rwxr-xr-xsrc/pr.bqn16
2 files changed, 17 insertions, 16 deletions
diff --git a/src/cjs.bqn b/src/cjs.bqn
index 8796df9a..6ed5c5ae 100755
--- a/src/cjs.bqn
+++ b/src/cjs.bqn
@@ -1,17 +1,18 @@
#! /usr/bin/env dbqn
compile ← ⟨•path∾"../c.bqn"⋄"DGenFn"⟩ •EX •path∾"../dzref"
-Symcomp ← ((<"runtime["∾⍕∾"]"˜)¨↕59)⊸Compile
+Comp ← ((<"runtime["∾⍕∾"]"˜)¨↕59)⊸Compile
FP ← ∞⊸=◶⟨⍕,"Infinity"⟩
Str ← "str("""∾∾⟜""")"
Char ← "'"(∾∾⊣)(⟨"\t","\n","\'"⟩∾<)⊑˜("'"∾˜•UCS 9‿10)⊑∘⊐⊢
-Fmt ← ≡◶⟨(⊑⍋)∘(∾⟜∞)◶⟨0⊸≤◶⟨"-"∾FP∘|,FP⟩,Char⟩⋄Str⋄⊑⟩
+Fconst ← ≡◶⟨(⊑⍋)∘(∾⟜∞)◶⟨0⊸≤◶⟨"-"∾FP∘|,FP⟩,Char⟩⋄Str⋄⊑⟩
L ← "["∾"]"∾˜1↓·∾","⊸∾⟜⍕¨
-G ← ⟨L∾⟜25,L Fmt¨,L⟨⊑"fmd"⊸⊐,⊢,⊢,≠⟩⊸(L{𝕎𝕩}¨)¨⟩ {𝕎𝕩}¨ 0‿1‿3 ⊏ Symcomp
-Gen ← L G
-GenLong ← ∾ (1‿2/⟨" new Uint8Array("∾∾⟜")"⋄((•UCS 10)∾" ,")⊸∾⟩) {𝕎𝕩}¨ G
+J ← ∾∾⟜(•UCS 10)¨
+Fout ← ⟨L∾⟜25,L Fconst¨,L⟨⊑"fmd"⊸⊐,⊢,⊢,≠⟩⊸(L{𝕎𝕩}¨)¨⟩ {𝕎𝕩}¨ 0‿1‿3 ⊏ ⊢
+Frun ← ("provide.concat("∾∾⟜")")⌾(1⊸⊑) Fout
+Long ← ∾ (1‿2/⟨" new Uint8Array("∾∾⟜")"⋄((•UCS 10)∾" ,")⊸∾⟩) {𝕎𝕩}¨ ⊢
• ← (⊑"r"‿"c"⊐⊏)◶⟨
- {𝕩⋄GenLong •EX •path∾"pr.bqn"}
- {𝕩⋄GenLong ∾∾⟜(•UCS 10)¨ •LNS •path∾"c.bqn"}
- ∾·∾⟜(•UCS 10)¨ Gen¨
+ {𝕩⋄Long Frun {𝕩⊸↓⌾(1⊸⊑)Comp𝕨}´ •EX •path∾"pr.bqn"}
+ {𝕩⋄Long Fout Comp J •LNS •path∾"c.bqn"}
+ J L∘Fout∘Comp¨
⟩ •args
diff --git a/src/pr.bqn b/src/pr.bqn
index d9ae5ef4..a93bd4eb 100755
--- a/src/pr.bqn
+++ b/src/pr.bqn
@@ -24,11 +24,15 @@ Inc ← {
}
# Required functionality passed in as an argument
-pnam ← ⟨"IsArray","Type","Log","GroupLen","GroupOrd"⟩∾names⊏˜chr⊐"!+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘"
+def ← ⟨"IsArray","Type","Log","GroupLen","GroupOrd"⟩
+keep ← "!+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘"
+ki ← chr⊐keep
+kt ← (+`nc)(∾((≠def)∾¯1↓⊣)+⊔⟜⊒∘⍋)ki
+names ↩ (⥊¨kt⊏chr)⌾(ki⊸⊏)names
E_isdef ← (3≤≠)◶⟨0,∧´⟨chr," ","←↩"⟩∊˜¨3⊸↑⟩
-E_proc ← {
+E_proc ← ({𝕨∘𝕩}´ {𝕨•_R_𝕩}⟜⥊¨⟜(≠↑chr˜) def)∘{
l←≠chr
q←≠`𝕩∊"""'" ⋄ f←¬∨`q¬⊸∧𝕩='#'
∾ (((l×f/q)+chr⊸⊐) (≥⟜l)◶⟨⊑⟜names,⥊∘⊢⟩¨ ⊢) f/𝕩
@@ -39,9 +43,5 @@ E_redef ← { # handles [fmd] [←↩]
(E_proc 1↑𝕩) ∾ "←" ∾ tail
}
-ref ← ∾ ∾⟜(•UCS 10)¨ ∾⟨
- ⟨"{"⟩
- ⟨"←𝕩"∾˜"⟨"∾"⟩"∾˜1↓∾","⊸∾¨pnam⟩
- E_isdef◶E_proc‿E_redef¨ impl∾<"⟨"∾"⟩"∾˜1↓⥊","⊸∾˘∾chrs
- ⟨"}"⟩
-⟩
+ref ← ∾∾⟜(•UCS 10)¨ E_isdef◶E_proc‿E_redef¨ impl∾<"⟨"∾"⟩"∾˜1↓⥊","⊸∾˘chr
+⟨ref, def+○≠keep⟩