pass fully native primitives to r1
This commit is contained in:
parent
32afb4b4ab
commit
5979c0fed9
26
build/cc.bqn
26
build/cc.bqn
@ -2,7 +2,7 @@
|
|||||||
# Modified version of https://github.com/mlochbaum/BQN/blob/master/src/cjs.bqn, which is under the ISC license (https://github.com/mlochbaum/BQN/blob/master/LICENSE)
|
# Modified version of https://github.com/mlochbaum/BQN/blob/master/src/cjs.bqn, which is under the ISC license (https://github.com/mlochbaum/BQN/blob/master/LICENSE)
|
||||||
|
|
||||||
args←•args
|
args←•args
|
||||||
"Usage: ./cc.bqn path/to/mlochbaum/BQN [-i] <(r|r0|r1|c|cc|f|e|p) or an expression>"!2≤≠args
|
"Usage: ./cc.bqn path/to/mlochbaum/BQN [-i] <(r|r0|r1|r1x|c|cc|f|e|p) or an expression>"!2≤≠args
|
||||||
return ← 1≡⊑args
|
return ← 1≡⊑args
|
||||||
args↓˜↩ return
|
args↓˜↩ return
|
||||||
path←(⊑args)∾"/src/"
|
path←(⊑args)∾"/src/"
|
||||||
@ -51,16 +51,34 @@ Frun ← 1⊸Fout
|
|||||||
Long ← {¯2↓∾𝕩∾¨<","∾@+10}
|
Long ← {¯2↓∾𝕩∾¨<","∾@+10}
|
||||||
LFC ← Long∘Fout∘Comp
|
LFC ← Long∘Fout∘Comp
|
||||||
|
|
||||||
|
primN ← ⟨
|
||||||
|
"add", "sub", "mul", "div", "pow", "root", "floor", "ceil", "stile", "not"
|
||||||
|
"and", "or", "lt", "gt", "ne", "eq", "le", "ge", "feq", "fne"
|
||||||
|
"ltack", "rtack", "shape", "join", "couple", "pair", "take", "drop", "ud", "shifta"
|
||||||
|
"shiftb", "reverse", "transp", "slash", "gradeUp", "gradeDown", "select", "pick", "indexOf", "count"
|
||||||
|
"memberOf", "find", "group", "asrt", "const", "swap", "cell", "each", "tbl", "undo"
|
||||||
|
"fold", "insert", "scan", "atop", "over", "before", "after", "under", "val", "cond"
|
||||||
|
"rank", "depth", "repeat", "catch"
|
||||||
|
⟩
|
||||||
|
primC ← "+-×÷⋆√⌊⌈|¬∧∨<>≠=≤≥≡≢⊣⊢⥊∾≍⋈↑↓↕«»⌽⍉/⍋⍒⊏⊑⊐⊒∊⍷⊔!˙˜˘¨⌜⁼´˝`∘○⊸⟜⌾⊘◶⎉⚇⍟⎊"
|
||||||
|
pre ← "+-=×↕≢≤⊑⊘⌊⌜⥊!<>`|¨´÷˙˜↑↓∘∾≠≥⊢⊣⊸⋆⋈⌈⍟⎊○◶⟜"
|
||||||
|
isFull ← ¬ primC ∊ "⁼⊏/⊔⌾⍷⚇˝"
|
||||||
|
fullC ← isFull/primC
|
||||||
|
extraC ← pre (¬∘∊˜/⊢) fullC
|
||||||
|
# •Out List "bi_"⊸∾¨ (primC∊extraC) / primN
|
||||||
|
|
||||||
RT ← {
|
RT ← {
|
||||||
src‿need‿inputs←𝕩Import"pr.bqn"
|
ext ← 2=≠𝕩
|
||||||
|
𝕩 ↩ ⊑𝕩
|
||||||
|
src‿need‿inputs←((ext⊑𝕩‿1) ∾ ext/⟨fullC, extraC⟩) Import "pr.bqn"
|
||||||
pr←"runtime_0"‿"provide"{(∾𝕨<⊸(<∘{∾"incG("‿𝕨‿"["‿𝕩‿"])"}⟜F¨)⟜(↕≠)¨𝕩)⊏˜(∾𝕩)⊐∾need}○((-1+1=𝕩)⊸↑)inputs
|
pr←"runtime_0"‿"provide"{(∾𝕨<⊸(<∘{∾"incG("‿𝕨‿"["‿𝕩‿"])"}⟜F¨)⟜(↕≠)¨𝕩)⊏˜(∾𝕩)⊐∾need}○((-1+1=𝕩)⊸↑)inputs
|
||||||
Long Fout pr need _getComp src
|
Long Fout pr need _getComp src
|
||||||
}
|
}
|
||||||
CArg ← {J (¯5⊸↓∾𝕩˙)⌾⊑ FLines "c.bqn"}
|
CArg ← {J (¯5⊸↓∾𝕩˙)⌾⊑ FLines "c.bqn"}
|
||||||
SVG ← {∾⟨"Modify←GetHighlights←⊢⋄"⟩∾ FChars∘∾⟜".bqn"¨ "../svg"‿𝕩}
|
SVG ← {∾⟨"Modify←GetHighlights←⊢⋄"⟩∾ FChars∘∾⟜".bqn"¨ "../svg"‿𝕩}
|
||||||
|
|
||||||
(@+10)∾˜ •Out⍟(¬return) (⊑"r"‿"r0"‿"r1"‿"c"‿"cc"‿"f"‿"e"‿"eu"‿"p"⊐⊏)◶⟨
|
(@+10)∾˜ •Out⍟(¬return) (⊑"r"‿"r0"‿"r1"‿"r1x"‿"c"‿"cc"‿"f"‿"e"‿"eu"‿"p"⊐⊏)◶⟨
|
||||||
RT∘2, RT∘0, RT∘1
|
RT∘2, RT∘0, RT∘1, RT∘1‿'x'
|
||||||
{𝕩⋄LFC CArg "⟨"∾"⟩"«∾","⊸∾¨'"'(⊣∾∾˜)¨glyphs}
|
{𝕩⋄LFC CArg "⟨"∾"⟩"«∾","⊸∾¨'"'(⊣∾∾˜)¨glyphs}
|
||||||
{𝕩⋄LFC "{"∾"}"∾˜CArg"𝕩"}
|
{𝕩⋄LFC "{"∾"}"∾˜CArg"𝕩"}
|
||||||
{𝕩⋄LFC FChars "f.bqn"}
|
{𝕩⋄LFC FChars "f.bqn"}
|
||||||
|
|||||||
@ -10,5 +10,6 @@ CC ← {𝕨 •FChars (⟨1,bqnSrc⟩∾(rtSrc/⟨"-i"⟩)∾⟨𝕩⟩) •Imp
|
|||||||
(outputPath•file.At "gen/compiles" )CC"cc"
|
(outputPath•file.At "gen/compiles" )CC"cc"
|
||||||
(outputPath•file.At "gen/runtime0" )CC"r0"
|
(outputPath•file.At "gen/runtime0" )CC"r0"
|
||||||
(outputPath•file.At "gen/runtime1" )CC"r1"
|
(outputPath•file.At "gen/runtime1" )CC"r1"
|
||||||
|
(outputPath•file.At "gen/runtime1x")CC"r1x"
|
||||||
(outputPath•file.At "gen/formatter")CC"f"
|
(outputPath•file.At "gen/formatter")CC"f"
|
||||||
(outputPath•file.At "gen/explain" )CC"eu"
|
(outputPath•file.At "gen/explain" )CC"eu"
|
||||||
|
|||||||
13
src/load.c
13
src/load.c
@ -399,7 +399,12 @@ void load_init() { // very last init function
|
|||||||
B frtObj = m_caB(RT_LEN, fruntime);
|
B frtObj = m_caB(RT_LEN, fruntime);
|
||||||
|
|
||||||
#ifndef NO_RT
|
#ifndef NO_RT
|
||||||
B provide[] = {bi_type,bi_fill,bi_log,bi_grLen,bi_grOrd,bi_asrt,bi_add,bi_sub,bi_mul,bi_div,bi_pow,bi_floor,bi_eq,bi_le,bi_fne,bi_shape,bi_pick,bi_ud,bi_tbl,bi_scan,bi_fillBy,bi_val,bi_catch};
|
B provide[] = {
|
||||||
|
/* actual provide: */
|
||||||
|
bi_type,bi_fill,bi_log,bi_grLen,bi_grOrd,bi_asrt,bi_add,bi_sub,bi_mul,bi_div,bi_pow,bi_floor,bi_eq,bi_le,bi_fne,bi_shape,bi_pick,bi_ud,bi_tbl,bi_scan,bi_fillBy,bi_val,bi_catch
|
||||||
|
/* result list from commented-out •Out line in cc.bqn: */,
|
||||||
|
bi_root,bi_not,bi_and,bi_or,bi_feq,bi_couple,bi_shifta,bi_shiftb,bi_reverse,bi_transp,bi_gradeUp,bi_gradeDown,bi_indexOf,bi_count,bi_memberOf,bi_cell,bi_rank
|
||||||
|
};
|
||||||
#ifndef ALL_R0
|
#ifndef ALL_R0
|
||||||
B runtime_0[] = {bi_floor,bi_ceil,bi_stile,bi_lt,bi_gt,bi_ne,bi_ge,bi_rtack,bi_ltack,bi_join,bi_pair,bi_take,bi_drop,bi_select,bi_const,bi_swap,bi_each,bi_fold,bi_atop,bi_over,bi_before,bi_after,bi_cond,bi_repeat};
|
B runtime_0[] = {bi_floor,bi_ceil,bi_stile,bi_lt,bi_gt,bi_ne,bi_ge,bi_rtack,bi_ltack,bi_join,bi_pair,bi_take,bi_drop,bi_select,bi_const,bi_swap,bi_each,bi_fold,bi_atop,bi_over,bi_before,bi_after,bi_cond,bi_repeat};
|
||||||
#else
|
#else
|
||||||
@ -411,7 +416,11 @@ void load_init() { // very last init function
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
Block* runtime_b = load_compImport("(self-hosted runtime1)",
|
Block* runtime_b = load_compImport("(self-hosted runtime1)",
|
||||||
#include PRECOMPILED_FILE(runtime1)
|
#if ALL_R0 || ALL_R1 || NO_EXTENDED_PROVIDE || RT_VERIFY || !__has_include(PRECOMPILED_FILE(runtime1x))
|
||||||
|
#include PRECOMPILED_FILE(runtime1)
|
||||||
|
#else
|
||||||
|
#include PRECOMPILED_FILE(runtime1x)
|
||||||
|
#endif
|
||||||
);
|
);
|
||||||
|
|
||||||
#ifdef ALL_R0
|
#ifdef ALL_R0
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user