aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xdc.bqn2
-rwxr-xr-xtest/dz_rt65
2 files changed, 14 insertions, 53 deletions
diff --git a/dc.bqn b/dc.bqn
index ad0b4235..c00d0e13 100755
--- a/dc.bqn
+++ b/dc.bqn
@@ -13,7 +13,7 @@ prims ← (•Import "dzref"){𝔽} "⟨
special←<˘∘‿2⥊"𝕤𝕩𝕨𝕣𝕗𝕘"
DCompile⇐{
- ⟨bc,o,fblk,ind⟩ ← 4 ↑ prims Compile 𝕩
+ ⟨bc,o,fblk,ind⟩ ← 4 ↑ (𝕨⊣prims) Compile 𝕩
blk‿bdy ← <˘⍉>(↕≠fblk){
⟨t,i,l,n⟩←𝕩
s←(3×i)↓(t⊑3‿5‿6)↑special
diff --git a/test/dz_rt b/test/dz_rt
index 4c7c6c89..9d2f2aa9 100755
--- a/test/dz_rt
+++ b/test/dz_rt
@@ -2,59 +2,20 @@
# Compile and run the primitive implementations, and prim.bqn
-impl ← •LNS "../src/r.bqn"
-
-⟨DRun⟩ ← •Import "../dc.bqn"
-
-chrs←⟨
- "!+-×÷⋆√⌊⌈∧∨¬|=≠≤<>≥≡≢⊣⊢⥊∾≍↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔"
- "˙˜˘¨⌜⁼´˝`"
- "∘⊸⟜○⌾⎉⚇⍟◶⊘"
+⟨ref⟩ ← •Import "../src/pr.bqn"
+⟨DRun,DCompile⟩ ← •Import "../dc.bqn"
+
+provide ← ⟨
+ 0≠≡ # IsArray
+ ⊑⟨⟩⥊0⊸⥊ # Type
+ ⋆⁼ # Log
+ ≠¨⊔ # GroupLen
+ ∾⊔∘⊢ # GroupOrd
+ !,+,-,×,÷,⋆,⌊,=,≤,≢,⥊,⊑,↕,⌜,`,⊘
-nc ← ≠¨chrs
-chr ← ∾chrs
-itr ← 0⥊˜≠chr
-
-init ← " "⊸∾¨(/⟜"_"¨nc/0‿1‿1)∾¨(nc/"FMD")∾¨(nc+´⊸↑⥊"ABC"∾⌜•a)
-post ← ∾⟜" "¨/⟜"_"¨nc/0‿0‿1
-names ← init∾¨'0'∾¨post
-
-Inc ← {
- i←⊑chr⊐𝕩
- n←0 ⋄ itr↩{n↩1+𝕩}⌾(i⊑⊢)itr
- names↩((i⊑init)∾('0'+n)∾i⊑post)⌾(i⊑⊢)names
-}
-
-# built-in assumptions
-Mod ← {((⊑chr⊐𝕨)⊑names) ∾ " ← " ∾ 𝕩}
-
-pre ← ⟨
- "IsArray ← 0≠≡"
- "Type ← ⊑⟨⟩⥊0⊸⥊"
- "Log ← ⋆⁼"
- "GroupLen← ≠¨⊔"
- "GroupOrd← ∾⊔∘⊢"
- '!' Mod "{𝕩 ⋄ ≤1}⍟(1≢⊢)"
-⟩∾Mod⟜⥊¨ "+-×÷⋆⌊=≤≢⥊⊑↕⌜`⊘"
-
-
-# checks if line is a builtin redefinition
-E_isdef ← (3≤≠)◶⟨0,∧´⟨chr," ","←↩"⟩∊˜¨3⊸↑⟩
-
-# removes comments and replaces built-ins with names
-E_proc ← {
- l←≠chr
- q←≠`𝕩='"' ⋄ q∨↩≠`q<𝕩=''' ⋄ f←¬∨`q<𝕩='#'
- ∾ (((l×f/q)+chr⊸⊐) (≥⟜l)◶⟨⊑⟜names,⥊∘⊢⟩¨ ⊢) f/𝕩
-}
+rt ← •COMP provide⊸(⊣»«)⌾(1⊸⊑) DCompile ref
-E_redef ← { # handles [fmd] [←↩]
- tail ← E_proc 3↓𝕩 # must use old def
- Inc ⊑𝕩
- (E_proc 1↑𝕩) ∾ "←" ∾ tail
-}
+t ← "¬⟨"‿"⟩" (1⌽⌽⊸∾) (¬∘⊑':'∊⊢)¨⊸/ •LNS "prim.bqn"
+res ← rt DRun ∾ ∾⟜(@+10)¨ t
-pre ∾↩ E_isdef◶E_proc‿E_redef¨ impl
-t ← ⟨"¬⟨"⟩∾⟨"⟩"⟩∾˜ (¬∘⊑':'∊⊢)¨⊸/ •LNS "prim.bqn"
-res ← DRun ∾ ∾⟜(@+10)¨ pre ∾ E_proc¨ t
•Out ("All "∾(⍕≠res)∾" passed!")⍟(0=≠) /res