pass fully native primitives to r1

This commit is contained in:
dzaima 2023-05-09 21:46:39 +03:00
parent 32afb4b4ab
commit 5979c0fed9
3 changed files with 34 additions and 6 deletions

View File

@ -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)
args•args
"Usage: ./cc.bqn path/to/mlochbaum/BQN [-i] <(r|r0|r1|c|cc|f|e|p) or an expression>"!2args
"Usage: ./cc.bqn path/to/mlochbaum/BQN [-i] <(r|r0|r1|r1x|c|cc|f|e|p) or an expression>"!2args
return 1args
args˜ return
path(args)"/src/"
@ -51,16 +51,34 @@ Frun ← 1⊸Fout
Long {¯2𝕩¨<","@+10}
LFC LongFoutComp
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 {
srcneedinputs𝕩Import"pr.bqn"
ext 2=𝕩
𝕩 𝕩
srcneedinputs((ext𝕩1) ext/fullC, extraC) Import "pr.bqn"
pr"runtime_0""provide"{(𝕨<(<{"incG("𝕨"["𝕩"])"}F¨)()¨𝕩)˜(𝕩)need}((-1+1=𝕩))inputs
Long Fout pr need _getComp src
}
CArg {J (¯5𝕩˙) FLines "c.bqn"}
SVG {"Modify←GetHighlights←⊢⋄" FChars".bqn"¨ "../svg"𝕩}
(@+10)˜ •Out(¬return) ("r""r0""r1""c""cc""f""e""eu""p")
RT2, RT0, RT1
(@+10)˜ •Out(¬return) ("r""r0""r1""r1x""c""cc""f""e""eu""p")
RT2, RT0, RT1, RT1'x'
{𝕩LFC CArg "⟨""⟩"«","¨'"'(˜)¨glyphs}
{𝕩LFC "{""}"˜CArg"𝕩"}
{𝕩LFC FChars "f.bqn"}

View File

@ -10,5 +10,6 @@ CC ← {𝕨 •FChars (⟨1,bqnSrc⟩∾(rtSrc/⟨"-i"⟩)∾⟨𝕩⟩) •Imp
(outputPath•file.At "gen/compiles" )CC"cc"
(outputPath•file.At "gen/runtime0" )CC"r0"
(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/explain" )CC"eu"

View File

@ -399,7 +399,12 @@ void load_init() { // very last init function
B frtObj = m_caB(RT_LEN, fruntime);
#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
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
@ -411,7 +416,11 @@ void load_init() { // very last init function
#endif
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