aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-22 14:10:34 -0400
committerMarshall Lochbaum <mwlochbaum@gmail.com>2021-04-22 14:10:34 -0400
commit6c3f798b272bc0e920791d6555ce66c7f958a5d6 (patch)
treeb0258b74fc35a18fcb8fd2c299258ac8aadf1e09
parent081237c27b912723438f498ffaa53a079a597b1b (diff)
Pass set of primitive glyphs into compiler as •args
-rwxr-xr-xdc.bqn9
-rw-r--r--src/c.bqn7
-rwxr-xr-xsrc/cjs.bqn6
3 files changed, 11 insertions, 11 deletions
diff --git a/dc.bqn b/dc.bqn
index d236dcc1..2a41bbbb 100755
--- a/dc.bqn
+++ b/dc.bqn
@@ -4,12 +4,9 @@
# 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 ← ⟨
- +,-,×,÷,⋆,√,⌊,⌈,|,¬,∧,∨,<,>,≠,=,≤,≥,≡,≢,⊣,⊢,⥊,∾,≍,↑,↓,↕,«,»,⌽,⍉,/,⍋,⍒,⊏,⊑,⊐,⊒,∊,⍷,⊔,!
- ˙,˜,˘,¨,⌜,⁼,´,˝,`
- ∘,○,⊸,⟜,⌾,⊘,◶,⎉,⚇,⍟
-⟩
+glyphs ← •Import "src/glyphs.bqn"
+compile ← glyphs •Import "src/c.bqn"
+prims ← •BQN∘⥊¨ ∾glyphs
special←<˘∘‿2⥊"𝕤𝕩𝕨𝕣𝕗𝕘"
DCompile⇐{
diff --git a/src/c.bqn b/src/c.bqn
index f6c1ccbb..f9151815 100644
--- a/src/c.bqn
+++ b/src/c.bqn
@@ -1,8 +1,9 @@
+func‿mod1‿mod2 ← •args
lf←@+10
charSet‿cgl←(∾ ≍○< ≠¨)⟨
- "+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!" # Function
- "˙˜˘¨⌜⁼´˝`" # 1-modifier
- "∘○⊸⟜⌾⊘◶⎉⚇⍟⎊" # 2-modifier
+ func # Function
+ mod1 # 1-modifier
+ mod2 # 2-modifier
"⋄,"∾lf # Separator
"⇐←↩" # Gets
"(){}⟨⟩" # Bracket
diff --git a/src/cjs.bqn b/src/cjs.bqn
index e2e8b057..487740f0 100755
--- a/src/cjs.bqn
+++ b/src/cjs.bqn
@@ -18,7 +18,8 @@ F ← ⍕ # Format number
FP ← ∞⊸=◶⟨F,"Infinity"⟩ # Format positive number
Num ← 0⊸≤◶⟨"-"∾FP∘|,FP⟩ # Format number
-compile ← •Import "c.bqn"
+glyphs ← •Import "glyphs.bqn"
+compile ← glyphs •Import "c.bqn"
useInd ← "-i"≡⊑args←•args ⋄ args↓˜↩useInd
Comp ← (3+useInd) ↑ ((<"runtime" Ind F)¨↕62)⊸Compile
J ← ∾∾⟜(@+10)¨
@@ -29,7 +30,8 @@ Long ← ∾ (≠↑1‿3/⟨" "⊸∾⋄((@+10)∾" ,")⊸∾⟩˙) {𝕎𝕩}
SVG ← {∾⟨"Modify←GetHighlights←⊢⋄"⟩∾ •FChars∘∾⟜".bqn"¨ "../svg"‿𝕩}
•Out (⊑"r"‿"c"‿"f"‿"e"‿"p"⊐⊏)◶⟨
{𝕩⋄ref‿len←•Import"pr.bqn"⋄Long Frun len⊸↓⌾(1⊸⊑)Comp ref}
- {𝕩⋄Long Fout Comp •FChars "c.bqn"}
+ {𝕩⋄g←"⟨"∾"⟩"«∾","⊸∾¨'"'(⊣∾∾˜)¨glyphs
+ Long Fout Comp J (¯5⊸↓∾g˙)⌾⊑ •FLines "c.bqn"}
{𝕩⋄Long Fout Comp •FChars "f.bqn"}
{𝕩⋄Long Fout Comp SVG "e"}
{𝕩⋄Long Fout Comp SVG "p"}