hoon: bscl to bccl, etc

This commit is contained in:
John Franklin 2020-11-17 01:05:17 -06:00
parent 19b6724f22
commit 11f8ba23d7
9 changed files with 372 additions and 370 deletions

View File

@ -897,7 +897,7 @@
++ dy-hoon-var
=+ ^= ope
|= gen/hoon ^- hoon
?: ?=(?($sgld $sgbn) -.gen)
?: ?=(?($sggl $sggr) -.gen)
$(gen q.gen)
=+ ~(open ap gen)
?.(=(gen -) $(gen -) gen)

View File

@ -33,8 +33,8 @@
:: Parsed with a static path for reproducibility.
::
=/ whole-hoon=hoon
:+ %tsbn compiler-hoon
:+ %tsld (rain /sys/arvo/hoon arvo-source)
:+ %tsgr compiler-hoon
:+ %tsgl (rain /sys/arvo/hoon arvo-source)
[%$ 7]
:: compile the whole schmeer
::

View File

@ -35,7 +35,7 @@
:: compile arvo against hoon, with our current compiler
::
=/ whole-hoon=hoon
[%tsbn compiler-hoon [%tsbn [%$ 7] (rain arvo-path arvo-src)]]
[%tsgr compiler-hoon [%tsgr [%$ 7] (rain arvo-path arvo-src)]]
~& %solid-parsed
=/ whole-formula q:(~(mint ut %noun) %noun whole-hoon)
~& %solid-arvo

View File

@ -144,7 +144,7 @@
[^ *] (both p.gen q.gen)
[%ktcn *] loop(gen p.gen)
[%brcn *] (grow q.gen)
[%brvt *] (grow q.gen)
[%brpt *] (grow q.gen)
[%cnts *]
|- ^- (unit [term type])
=* inner-loop $
@ -165,13 +165,13 @@
[%hand *] ~
[%ktbr *] loop(gen p.gen)
[%ktls *] (both p.gen q.gen)
[%ktpd *] loop(gen p.gen)
[%ktpm *] loop(gen p.gen)
[%ktsg *] loop(gen p.gen)
[%ktwt *] loop(gen p.gen)
[%note *] loop(gen q.gen)
[%sgzp *] (both p.gen q.gen)
[%sgbn *] loop(gen q.gen) :: should check for hoon in p.gen
[%tsbn *] (change p.gen q.gen)
[%sggr *] loop(gen q.gen) :: should check for hoon in p.gen
[%tsgr *] (change p.gen q.gen)
[%tscm *]
%+ replace
loop(gen p.gen)
@ -185,7 +185,7 @@
[%lost *] loop(gen p.gen)
[%zpmc *] (both p.gen q.gen)
[%zpts *] loop(gen p.gen)
[%zpvt *] (both q.gen r.gen)
[%zppt *] (both q.gen r.gen)
[%zpzp *] ~
*
=+ doz=~(open ap gen)

View File

@ -17,7 +17,7 @@
{$face p/term q/wine}
{$list p/term q/wine}
{$pear p/term q/@}
{$bswt p/(list wine)}
{$bcwt p/(list wine)}
{$plot p/(list wine)}
{$stop p/@ud}
{$tree p/term q/wine}
@ -122,7 +122,7 @@
=^ cox gid $(q.ham q.q.ham)
:_(gid [%rose [" " (weld (trip p.q.ham) "(") ")"] cox ~])
::
{$bswt *}
{$bcwt *}
=^ coz gid (many p.q.ham)
:_(gid [%rose [[' ' ~] ['?' '(' ~] [')' ~]] coz])
::
@ -265,7 +265,7 @@
~
[~ u.for u.aft]
::
{$bswt *}
{$bcwt *}
|- ^- (unit tank)
?~ p.q.ham
~
@ -354,7 +354,7 @@
^= woz
^- wine
?. ?=({$stop *} q.ham)
?: ?& ?= {$bswt {$pear $n $0} {$plot {$pear $n $0} {$face *} ~} ~}
?: ?& ?= {$bcwt {$pear $n $0} {$plot {$pear $n $0} {$face *} ~} ~}
q.ham
=(1 (met 3 p.i.t.p.i.t.p.q.ham))
==
@ -364,7 +364,7 @@
?~ may
q.ham
=+ nul=[%pear %n 0]
?. ?& ?=({$bswt *} u.may)
?. ?& ?=({$bcwt *} u.may)
?=({* * ~} p.u.may)
|(=(nul i.p.u.may) =(nul i.t.p.u.may))
==
@ -458,7 +458,7 @@
::
{$fork *}
=+ yed=(sort ~(tap in p.sut) aor)
=- [p [%bswt q]]
=- [p [%bcwt q]]
|- ^- {p/{p/(map type @) q/(map @ wine)} q/(list wine)}
?~ yed
[dex ~]

View File

@ -340,7 +340,7 @@
[%brsg *] (rune '|~' ~ ~ (spec p.x) (hn q.x) ~)
[%brtr *] (rune '|*' ~ ~ (spec p.x) (hn q.x) ~)
[%brts *] (rune '|=' ~ ~ (spec p.x) (hn q.x) ~)
[%brvt *] (chapter '|@' ~ q.x) :: Ignoring p.x
[%brpt *] (chapter '|@' ~ q.x) :: Ignoring p.x
[%brwt *] (rune '|?' ~ ~ (hn p.x) ~)
[%clcb *] (rune ':_' ~ ~ (hoons ~[p q]:x))
[%clkt *] (rune ':^' ~ ~ (hoons ~[p q r s]:x))
@ -370,7 +370,7 @@
[%ktdt *] (rune '^.' ~ ~ (hoons ~[p q]:x))
[%ktls *] (rune '^+' ~ ~ (hoons ~[p q]:x))
[%kthp *] (rune '^-' ~ ~ ~[(spec p.x) (hn q.x)])
[%ktpd *] (rune '^&' ~ ~ (hoons ~[p]:x))
[%ktpm *] (rune '^&' ~ ~ (hoons ~[p]:x))
[%ktsg *] (rune '^~' ~ ~ (hoons ~[p]:x))
[%ktts *] (rune '^=' ~ `['' '=' ''] ~[(skin p.x) (hn q.x)])
[%ktwt *] (rune '^?' ~ ~ (hoons ~[p]:x))
@ -379,56 +379,58 @@
[%sgbr *] (rune '~|' ~ ~ (hoons ~[p q]:x))
[%sgcb *] (rune '~_' ~ ~ (hoons ~[p q]:x))
[%sgcn *] (rune '~%' ~ ~ (chum p.x) (hn q.x) (tyre r.x) (hn s.x) ~)
[%sgnt *] (rune '~/' ~ ~ (chum p.x) (hn q.x) ~)
[%sgld *] (rune '~<' ~ ~ (hint p.x) (hn q.x) ~)
[%sgbn *] (rune '~>' ~ ~ (hint p.x) (hn q.x) ~)
[%sgbs *] (rune '~$' ~ ~ p.x (hn q.x) ~)
[%sgfs *] (rune '~/' ~ ~ (chum p.x) (hn q.x) ~)
[%sggl *] (rune '~<' ~ ~ (hint p.x) (hn q.x) ~)
[%sggr *] (rune '~>' ~ ~ (hint p.x) (hn q.x) ~)
[%sgbc *] (rune '~$' ~ ~ p.x (hn q.x) ~)
[%sgls *] (rune '~+' ~ ~ (hn q.x) ~) :: Ignoring p.x
[%sgpd *] (rune '~&' ~ ~ (hoons ~[q r]:x)) :: Ignoring p.x
[%sgpm *] (rune '~&' ~ ~ (hoons ~[q r]:x)) :: Ignoring p.x
[%sgts *] (rune '~=' ~ ~ (hoons ~[p q]:x))
[%sgwt *] (rune '~?' ~ ~ (hoons ~[q r s]:x)) :: Ignoring p.x
[%sgzp *] (rune '~!' ~ ~ (hoons ~[p q]:x))
[%mcts *] %ast-node-mcts
[%mccl *] (rune ';:' `'==' `[':(' spc ')'] (hoons [p q]:x))
[%mcnt *] (rune ';/' ~ ~ (hoons ~[p]:x))
[%mcfs *] (rune ';/' ~ ~ (hoons ~[p]:x))
[%mcgl *] (rune ';<' ~ ~ (spec p.x) (hoons ~[q r s]:x))
[%mcsg *] (rune ';~' `'==' ~ (hoons [p q]:x))
[%mcmc *] (rune ';;' ~ ~ ~[(spec p.x) (hn q.x)])
[%tsbr *] (rune '=|' ~ ~ ~[(spec p.x) (hn q.x)])
[%tscl *] (tiscol-to-plum p.x q.x)
[%tsnt *] (rune '=/' ~ ~ (skin p.x) (hn q.x) (hn r.x) ~)
[%tsfs *] (rune '=/' ~ ~ (skin p.x) (hn q.x) (hn r.x) ~)
[%tsmc *] (rune '=;' ~ ~ [(skin p.x) (hoons ~[q r]:x)])
[%tsdt *] (rune '=.' ~ ~ [(wing p.x) (hoons ~[q r]:x)])
[%tswt *] (rune '=?' ~ ~ [(wing p.x) (hoons ~[q r s]:x)])
[%tsld *] (rune '=>' ~ `['' ':' ''] (hoons ~[p q]:x))
:: XX %tsld to %tsgl, but should be %tsgr? (to match =>)
[%tsgl *] (rune '=>' ~ `['' ':' ''] (hoons ~[p q]:x))
[%tshp *] (rune '=-' ~ ~ (hoons ~[p q]:x))
[%tsbn *] (rune '=<' ~ ~ (hoons ~[p q]:x))
:: XX %tsbn to %tsgr, but should be %tsgl? (to match =<)
[%tsgr *] (rune '=<' ~ ~ (hoons ~[p q]:x))
[%tskt *] (rune '=^' ~ ~ [(skin p.x) (wing q.x) (hoons ~[r s]:x)])
[%tsls *] (rune '=+' ~ ~ (hoons ~[p q]:x))
[%tssg *] (rune '=~' `'==' ~ (hoons p:x))
[%tstr *] ?~ q.p.x
(rune '=*' ~ ~ p.p.x (hoons ~[q r]:x))
(rune '=*' ~ ~ (spec [%bsts p.p.x u.q.p.x]) (hoons ~[q r]:x))
(rune '=*' ~ ~ (spec [%bcts p.p.x u.q.p.x]) (hoons ~[q r]:x))
[%tscm *] (rune '=,' ~ ~ (hoons ~[p q]:x))
[%wtbr *] (rune '?|' `'--' `['|(' ' ' ')'] (hoons p:x))
[%wthp *] (rune '?-' `'==' ~ (wing p.x) (matches q.x))
[%wtcl *] (rune '?:' ~ ~ (hoons ~[p q r]:x))
[%wtdt *] (rune '?.' ~ ~ (hoons ~[p q r]:x))
[%wtkt *] (rune '?^' ~ ~ [(wing p.x) (hoons ~[q r]:x)])
[%wtld *] (rune '?<' ~ ~ (hoons ~[p q]:x))
[%wtbn *] (rune '?>' ~ ~ (hoons ~[p q]:x))
[%wtgl *] (rune '?<' ~ ~ (hoons ~[p q]:x))
[%wtgr *] (rune '?>' ~ ~ (hoons ~[p q]:x))
[%wtls *] (rune '?+' `'==' ~ (wing p.x) (hn q.x) (matches r.x))
[%wtpd *] (rune '?&' `'==' `['&(' ' ' ')'] (hoons p:x))
[%wtvt *] (rune '?@' ~ ~ (wing p.x) (hoons ~[q r]:x))
[%wtpm *] (rune '?&' `'==' `['&(' ' ' ')'] (hoons p:x))
[%wtpt *] (rune '?@' ~ ~ (wing p.x) (hoons ~[q r]:x))
[%wtsg *] (rune '?~' ~ ~ (wing p.x) (hoons ~[q r]:x))
[%wthx *] (rune '?#' ~ ~ (skin p.x) (wing q.x) ~)
[%wtts *] (rune '?=' ~ ~ (spec p.x) (wing q.x) ~)
[%wtzp *] (rune '?!' ~ `['!' '' ''] (hoons ~[p]:x))
[%zpcm *] (rune '!,' ~ ~ (hoons ~[p q]:x))
[%zpbn *] (rune '!>' ~ ~ (hoons ~[p]:x))
[%zpgr *] (rune '!>' ~ ~ (hoons ~[p]:x))
[%zpmc *] (rune '!;' ~ ~ (hoons ~[p q]:x))
[%zpts *] (rune '!=' ~ ~ (hoons ~[p]:x))
[%zpvt *] (rune '!@' ~ ~ (wingseq p.x) (hoons ~[q r]:x))
[%zppt *] (rune '!@' ~ ~ (wingseq p.x) (hoons ~[q r]:x))
[%zpwt *] (hn q.x) :: Ignore p.x
[%zpzp ~] '!!'
==
@ -642,37 +644,37 @@
?: =(- 3) '%^'
?: =(- 2) '%+' '%-'
[(dohoon p.spec) (turn q.spec ..$)]
%bsbs (core-spec-to-plum '$$' p.spec q.spec)
%bsbr (subtree (fixed '$|') $(spec p.spec) (dohoon q.spec) ~)
%bscb (dohoon p.spec)
%bscl :- %sbrk
%bcbc (core-spec-to-plum '$$' p.spec q.spec)
%bcbr (subtree (fixed '$|') $(spec p.spec) (dohoon q.spec) ~)
%bccb (dohoon p.spec)
%bccl :- %sbrk
:+ %tree
[`[' ' `['[' ']']] `['$:' `['' '==']]]
(turn `(list ^spec)`+.spec ..$)
%bscn (subtree (varying '$%' '==') (turn `(list ^spec)`+.spec ..$))
%bsdt (core-spec-to-plum '$.' p.spec q.spec)
%bsld (subtree (fixed '$<') $(spec p.spec) $(spec q.spec) ~)
%bsbn (subtree (fixed '$>') $(spec p.spec) $(spec q.spec) ~)
%bshp (subtree (fixed '$-') $(spec p.spec) $(spec q.spec) ~)
%bskt (subtree (fixed '$^') $(spec p.spec) $(spec q.spec) ~)
%bsls (subtree (fixed '$+') (stud-to-plum p.spec) $(spec q.spec) ~)
%bsnt (core-spec-to-plum '$/' p.spec q.spec)
%bsmc (subtree (fixed '$;') (dohoon p.spec) ~)
%bspd (subtree (fixed '$&') $(spec p.spec) (dohoon q.spec) ~)
%bssg (subtree (fixed '$~') (dohoon p.spec) $(spec q.spec) ~)
%bstc (core-spec-to-plum '$`' p.spec q.spec)
%bsts :- %sbrk
%bccn (subtree (varying '$%' '==') (turn `(list ^spec)`+.spec ..$))
%bcdt (core-spec-to-plum '$.' p.spec q.spec)
%bcgl (subtree (fixed '$<') $(spec p.spec) $(spec q.spec) ~)
%bcgr (subtree (fixed '$>') $(spec p.spec) $(spec q.spec) ~)
%bchp (subtree (fixed '$-') $(spec p.spec) $(spec q.spec) ~)
%bckt (subtree (fixed '$^') $(spec p.spec) $(spec q.spec) ~)
%bcls (subtree (fixed '$+') (stud-to-plum p.spec) $(spec q.spec) ~)
%bcfs (core-spec-to-plum '$/' p.spec q.spec)
%bcmc (subtree (fixed '$;') (dohoon p.spec) ~)
%bcpm (subtree (fixed '$&') $(spec p.spec) (dohoon q.spec) ~)
%bcsg (subtree (fixed '$~') (dohoon p.spec) $(spec q.spec) ~)
%bctc (core-spec-to-plum '$`' p.spec q.spec)
%bcts :- %sbrk
:+ %tree
[`['=' ~] `['$=' ~]]
:~ (skin-to-plum p.spec)
$(spec q.spec)
==
%bsvt (subtree (fixed '$@') $(spec p.spec) $(spec q.spec) ~)
%bswt :- %sbrk
%bcpt (subtree (fixed '$@') $(spec p.spec) $(spec q.spec) ~)
%bcwt :- %sbrk
:+ %tree
[`[' ' `['?(' ')']] `['$?' `['' '==']]]
(turn `(list ^spec)`+.spec ..$)
%bszp (core-spec-to-plum '$.' p.spec q.spec)
%bczp (core-spec-to-plum '$.' p.spec q.spec)
==
::
++ varying
@ -850,7 +852,7 @@
|= [=sample=xkey =product=xkey]
^- plum
%- spec-to-plum :*
%bshp
%bchp
(ximage-to-spec:libxray sample-xkey img)
(ximage-to-spec:libxray product-xkey img)
==

View File

@ -355,8 +355,8 @@
=^ params=(list xkey) st
|- ^- [(list xkey) xtable]
?~ u.q.note [~ st]
=/ tsld [%tsld [%limb %$] [%wing i.u.q.note]]
=/ part (~(play ut subject-of-note) tsld)
=/ tsgl [%tsgl [%limb %$] [%wing i.u.q.note]]
=/ part (~(play ut subject-of-note) tsgl)
=^ this st (main st part)
=^ more st $(u.q.note t.u.q.note)
[[this more] st]
@ -1774,34 +1774,34 @@
=/ tl `spec`$(i tail.d)
=/ both-basic &(=([%base %noun] hd) =([%base %noun] tl))
?: both-basic [%base %cell]
?: ?=(%bscl -.tl) [%bscl hd +.tl]
[%bscl hd tl ~]
?: ?=(%bccl -.tl) [%bccl hd +.tl]
[%bccl hd tl ~]
%core =/ payld $(i xray.d)
=/ batt ^- (map term spec)
%- ~(run by (flatten-battery batt.d))
|= =xkey ^$(i xkey)
?- r.garb.d
%lead [%bszp payld batt]
%gold [%bsdt payld batt]
%zinc [%bstc payld batt]
%iron [%bsnt payld batt]
%lead [%bczp payld batt]
%gold [%bcdt payld batt]
%zinc [%bctc payld batt]
%iron [%bcfs payld batt]
==
%pntr !!
%face =/ =spec $(i xray.d)
?^(face.d spec [%bsts face.d spec])
?^(face.d spec [%bcts face.d spec])
%fork =/ =xrole (need xrole.x)
|^ ?+ xrole
~& [%unexpected-fork-xrole xkey.x d xrole choices]
[%bswt choices]
[%bcwt choices]
%noun [%base %noun]
%void [%base %void]
[%option *] [%bswt choices]
[%union *] [%bscn choices]
[%misjunction *] [%bswt choices]
[%junction *] :+ %bsvt
[%option *] [%bcwt choices]
[%union *] [%bccn choices]
[%misjunction *] [%bcwt choices]
[%junction *] :+ %bcpt
^$(i flat.xrole)
^$(i deep.xrole)
[%conjunction *] :+ %bskt
[%conjunction *] :+ %bckt
^$(i wide.xrole)
^$(i tall.xrole)
==
@ -1821,7 +1821,7 @@
^- spec
?. (need loop.xr) sp
=/ nm (synthetic xkey.xr)
[%bsbs [%loop nm] [[nm sp] ~ ~]]
[%bcbc [%loop nm] [[nm sp] ~ ~]]
::
:: If we have a `recipe`, we can generate much nicer output.
::

File diff suppressed because it is too large Load Diff

View File

@ -654,7 +654,7 @@
(with-faces old+old sam+sam ~)
:+ %sgzp !,(*hoon old=old)
:+ %sgzp !,(*hoon sam=sam)
:+ %tsld [%limb b]
:+ %tsgl [%limb b]
!, *hoon
~(grow old sam)
:: try direct +grab
@ -663,7 +663,7 @@
=/ rab
%- mule |.
%+ slap new
:+ %tsld [%limb a]
:+ %tsgl [%limb a]
[%limb %grab]
?: &(?=(%& -.rab) ?=(^ q.p.rab))
:_(nub |=(sam=vase ~|([%grab a b] (slam p.rab sam))))
@ -672,7 +672,7 @@
=/ jum
%- mule |.
%+ slap old
:+ %tsld [%limb b]
:+ %tsgl [%limb b]
[%limb %jump]
?: ?=(%& -.jum)
(compose-casts a !<(mark p.jum) b)