Added check for missing return ducts

This commit is contained in:
Anton Dyudin 2014-10-02 12:46:00 -07:00 committed by Anton Dyudin
parent dcef29a318
commit bc5128694d
4 changed files with 74 additions and 96 deletions

View File

@ -1,8 +1,8 @@
::::::
!: :: %ford, new execution control
:: :: %ford, new execution control
!? 164
::::
|= pit=vase
|= pit=vase
=> =~
:: structures
|%
@ -28,7 +28,7 @@
++ hoot (pair bean hoof) :: structure gate/core
++ hoop :: source in hood
$% [%& p=twig] :: direct twig
[%| p=beam] :: resource location
[%| p=beam] :: resource location
== ::
++ horn :: resource tree
$% [%ape p=twig] :: /~ twig by hand
@ -239,8 +239,8 @@
++ zo
|_ [num=@ud task]
++ abet %_(..zo q.tad.bay (~(put by q.tad.bay) num +<+))
++ amok
%_ ..zo
++ amok
%_ ..zo
q.tad.bay (~(del by q.tad.bay) num)
dym.bay (~(del by dym.bay) nah)
==
@ -427,11 +427,11 @@
|= bem=beam
=+ :* vez=(vang | (tope bem(r [%ud 0])))
voz=(vang | (tope bem))
==
==
=< hood
|%
|%
++ case
%- sear
%- sear
:_ nuck:so
|= a=coin
?. ?=([%$ ?(%da %ud %tas) *] a) ~
@ -520,18 +520,18 @@
(ifix [sel ser] (stag %cltr (most ace wide:vez)))
;~(pfix gap tall:vez)
::
++ day
++ day
%+ rail
apex(tol |)
apex(tol |)
;~(pfix gap apex)
::
++ dub
%+ rail
%+ rail
;~(plug sym ;~(pfix tis apex(tol |)))
;~(pfix gap ;~(plug sym ;~(pfix gap apex)))
::
++ fan
%+ rail fail
%+ rail fail
;~(sfix (star ;~(pfix gap apex)) ;~(plug gap duz))
::
++ for
@ -556,12 +556,12 @@
;~(pfix gap ;~(plug tall:vez ;~(pfix gap apex)))
::
++ see
%+ rail
%+ rail
;~(plug ;~(sfix have col) apex(tol |))
;~(pfix gap ;~(plug have ;~(pfix gap apex)))
::
++ sic
%+ rail
%+ rail
;~(plug ;~(sfix toil:vez ket) apex(tol |))
;~(pfix gap ;~(plug howl:vez ;~(pfix gap apex)))
--
@ -590,7 +590,7 @@
++ keel :: apply mutations
|= [cof=cafe suh=vase yom=(list (pair wing vase))]
^- (bolt vase)
%^ maim cof
%^ maim cof
%+ slop suh
|- ^- vase
?~ yom [[%atom %n] ~]
@ -637,7 +637,7 @@
(flaw cof [%leaf "ford: no noun: {<[for bek]>}"]~)
%+ cope (maul cof (slap gab [%cnzy %noun]) [%noun q.sam])
|= [cof=cafe pro=vase]
?: =(+<.q.pro q.sam)
?: =(+<.q.pro q.sam)
(fine cof (slot 6 pro))
(flaw cof [%leaf "ford: invalid content: {<[for bek]>}"]~)
::
@ -872,7 +872,7 @@
$(kas [%done p.kas u.q.kas])
::
%mute (kale cof p.kas q.kas)
%plan
%plan
%+ cope (abut:(meow p.kas q.kas) cof r.kas)
|= [cof=cafe vax=vase]
(fine cof %noun vax)
@ -886,7 +886,7 @@
|= [cof=cafe vax=vase]
(fine cof %noun vax)
::
%vale
%vale
%+ cool |.(leaf/"ford: vale {<p.kas>} {<q.kas>} {<`@p`(mug r.kas)>}")
%+ cope (lave cof p.kas q.kas r.kas)
|= [cof=cafe vax=vase]
@ -907,14 +907,12 @@
==
::
++ meow :: assemble
|= [how=beam arg=heel]
|= [how=beam arg=heel]
=| $: rop=(map term (pair hoof twig)) :: structure/complex
zog=(set term) :: structure guard
bil=(map term (pair hoof twig)) :: libraries known
lot=(list term) :: library stack
zeg=(set term) :: library guard
boy=(list twig) :: body stack
hol=? :: horns allowed?
==
|%
++ able :: assemble preamble
@ -935,7 +933,7 @@
:- %brcn
^- (map term foot)
%+ ~(put by `(map term foot)`(~(run by rop) |=([* a=twig] [%ash a])))
for
for
[%ash [%tssg (flop boy)]]
::
++ abut :: generate
@ -950,15 +948,12 @@
|= [cof=cafe gox=vase]
%+ cope (maim cof (slop gox bax) [%tssg (flop boy)])
|= [cof=cafe fin=vase]
(fine cof fin)
(fine cof fin)
:: ~> %slog.[0 ~(duck ut p.q.cay)]
::
++ apex :: build to body
|= [cof=cafe hyd=hood]
^- (bolt ,_..apex)
?. |(hol ?=(~ fan.hyd))
%+ flaw cof :_ ~ :- %leaf
"horns not allowed in structures and libraries: {<[how arg]>}"
%+ cope (body cof src.hyd)
|= [cof=cafe sel=_..apex]
=. ..apex sel
@ -1027,13 +1022,13 @@
^- (bolt vase)
?- -.hon
%ape (maim cof bax p.hon)
%arg
%arg
%+ cope (maim cof bax p.hon)
|= [cof=cafe gat=vase]
(maul cof gat !>([how arg]))
::
%day (chad cof bax %dr p.hon)
%dub
%dub
%+ cope $(hon q.hon)
|= [cof=cafe vax=vase]
(fine cof [[%face p.hon p.vax] q.vax])
@ -1072,7 +1067,7 @@
%now (chad cof bax %da p.hon)
%nap (chai cof bax p.hon)
%see $(hon q.hon, how p.hon)
%saw
%saw
%+ cope $(hon q.hon)
|= [cof=cafe sam=vase]
%+ cope (maim cof bax p.hon)
@ -1094,11 +1089,8 @@
++ head :: consume structures
|= [cof=cafe bir=(list hoot)]
|- ^- (bolt ,_..head)
?~ bir
?~ bir
(fine cof ..head)
?: (~(has in zog) p.q.i.bir)
(flaw cof [%leaf "circular structure dependency: {<i.bir>}"]~)
=+ goz=(~(put in zog) p.q.i.bir)
=+ byf=(~(get by rop) p.q.i.bir)
?^ byf
?. =(`hoof`q.i.bir `hoof`p.u.byf)
@ -1107,19 +1099,16 @@
=+ bem=(hone ?:(p.i.bir %gate %core) %sur q.i.bir)
%+ cope (fade cof %hook bem)
|= [cof=cafe hyd=hood]
%+ cope (apex(zog goz, hol |, boy ~) cof hyd)
%+ cope (apex(boy ~) cof hyd)
|= [cof=cafe sel=_..head]
?. =(bil bil.sel)
(flaw cof [%leaf "structures cannot include libraries: {<i.bir>}"]~)
=. ..head
%= sel
boy ?: p.i.bir
boy ?: p.i.bir
boy
(welp boy [[[%cnzy p.q.i.bir] [%$ 1]] ~])
zog zog
hol hol
zeg zeg
rop %+ ~(put by (~(uni by rop) rop.sel))
p.q.i.bir
p.q.i.bir
[q.i.bir [%tssg (flop boy.sel)]]
==
^^$(cof cof, bir t.bir)
@ -1136,8 +1125,8 @@
^- (bolt ,_..neck)
?~ bir (fine cof ..neck)
?: (~(has in zeg) p.i.bir)
(flaw cof [%leaf "circular library dependency: {<i.bir>}"]~)
=+ gez=(~(put in zeg) p.i.bir)
(flaw cof [%leaf "circular dependency: {<i.bir>}"]~)
=+ goz=(~(put in zeg) p.i.bir)
=+ byf=(~(get by bil) p.i.bir)
?^ byf
?. =(`hoof`i.bir `hoof`p.u.byf)
@ -1146,12 +1135,11 @@
=+ bem=(hone %core %lib i.bir)
%+ cope (fade cof %hook bem)
|= [cof=cafe hyd=hood]
%+ cope (apex(zeg gez, hol |, boy ~) cof hyd)
%+ cope (apex(zeg goz, boy ~) cof hyd)
|= [cof=cafe sel=_..neck]
=. ..neck
=. ..neck
%= sel
zeg zeg
hol hol
lot [p.i.bir lot]
bil (~(put by bil) p.i.bir [i.bir [%tssg (flop boy.sel)]])
==
@ -1162,7 +1150,7 @@
^- (bolt _..wilt)
?- -.hop
%& (fine cof ..wilt(boy [p.hop boy]))
%|
%|
%+ cool |.(leaf/"ford: wilt {<[(tope p.hop)]>}")
%+ cope (lend cof p.hop)
|= [cof=cafe arc=arch]
@ -1180,7 +1168,7 @@
|= [cof=cafe lef=(map term foot) sel=_..wilt]
%+ cope ^$(all r.all, cof cof, sel sel)
|= [cof=cafe rig=(map term foot) sel=_..wilt]
%+ cope
%+ cope
%= ^^^^$
cof cof
..wilt sel(boy ~)
@ -1235,9 +1223,9 @@
::
++ load :: highly forgiving
|= old=*
=. old
=. old
?. ?=([%0 *] old) old :: remove at 1
:- %1
:- %1
|- ^- *
?~ +.old ~
?> ?=([n=[p=* q=[tad=* dym=* jav=*]] l=* r=*] +.old)

View File

@ -266,7 +266,9 @@
=+ lum=(lump t.pax)
=+ mat=(~(get by pol.all) p.p.lum)
?~ mat [~ ..^$]
?. (~(has by bum.u.mat) q.p.lum) ~& %too-late [~ ..^$]
=+ sat=(~(get by bum.u.mat) q.p.lum)
?~ sat ~& %too-late [~ ..^$]
?. (~(has by q.zam.u.sat) hen) ~& %app-lost [~ ..^$]
=< abet =< work
(more:(bear:(gaff p.lum) hen) q.lum hin)
::
@ -333,7 +335,7 @@
^- [(list move) _..^^$]
?> ?=(?(%mess %show %nuke) -.kon)
=+ you=`ship`?-(-.kon %mess p.kon, %nuke p.kon, %show p.kon)
=+ mat=(need (~(get by pol.all) you))
=+ mat=(~(got by pol.all) you)
=+ sad==+(sad=(~(get by sap.mat) our) ?^(sad u.sad *scad))
=^ num sad
=+ nym=(~(get by q.sad) hen)
@ -439,9 +441,9 @@
++ gawd :: %r handle response
|= [hen=duct saq=sack imp=path num=@ud ron=roon]
^- [p=(list move) q=_..^$]
=+ mat=(need (~(get by pol.all) p.saq))
=+ sad=(need (~(get by sap.mat) q.saq))
=+ neh=(need (~(get by r.sad) num))
=+ mat=(~(got by pol.all) p.saq)
=+ sad=(~(got by sap.mat) q.saq)
=+ neh=(~(got by r.sad) num)
:_ ..^$
:- [hen %give %nice ~] :_ ~
^- move :- neh
@ -524,7 +526,7 @@
::
++ bear :: write backward
|= hen=duct
=+ orf=(need (~(get by q.zam.sat) hen))
=+ orf=(~(got by q.zam.sat) hen)
~(apex bo:~(. au (read q.orf)) hen p.orf (rite q.orf) ~)
::
++ beef :: read in
@ -599,7 +601,7 @@
::
++ bing :: reset to duct
|= neh=duct
=+ orf=(need (~(get by q.zam.sat) neh))
=+ orf=(~(got by q.zam.sat) neh)
%_ +>.$
hen neh
ost p.orf
@ -652,7 +654,7 @@
%= +>.$
vey.sat
%- ~(put to vey.sat)
:- (need (~(get by r.zam.sat) p.i.pys))
:- (~(got by r.zam.sat) p.i.pys)
[%show q.i.pys]
==
::
@ -920,8 +922,8 @@
?~ pex +>.^$
%= $
pex t.pex
+>.^$ %- quem(hen (need (~(get by r.zam.sat) p.i.pex)))
[%show (need (~(get by sup.sat) p.i.pex))]
+>.^$ %- quem(hen (~(got by r.zam.sat) p.i.pex))
[%show (~(got by sup.sat) p.i.pex)]
==
::
++ mort :: failed boot
@ -1058,6 +1060,7 @@
(xeno t.imp %cide i.imp)
?. (~(has by bum.mat) [p.kon imp])
~& > [%cide-missed p.kon imp] +>.$(qic.sat ~)
::~& [%cide-found p.kon imp]
=. +>.$ (xeno [p.kon imp] %cede ~)
%_ +>.$
cub.sat (~(del by cub.sat) p.kon)
@ -1119,6 +1122,7 @@
%sire
?: (~(has by bum.mat) [q.kon imp])
~& > %sire-redundant +>.$(qic.sat ~)
::~& [%sire-made p.kon imp]
=: cub.sat (~(put by cub.sat) q.kon p.kon)
qic.sat ~
bum.mat

View File

@ -30,8 +30,6 @@
[%end p=(each ,@u cord)] ::
[%path p=path] ::
[%hoon p=twig] ::
[%var p=term q=twig] ::
[%rvar p=term] ::
[%pipe p=term q=(list twig) r=term s=(list twig)] ::
== ::
++ sign ::
@ -52,7 +50,6 @@
act=(unit span)
pip=(map span span)
pop=(map span span)
var=(map term vase)
==
++ maybe
|* fel=_rule
@ -79,8 +76,6 @@
(stag %end ;~(pfix sem ;~(pose (stag %& dem) (stag %| sym))))
(stag %path (sear plex rood):(vang & pax))
(stag %pipe pipe(pax paf))
(stag %var ;~(plug ;~(pfix tis sym) ;~(pfix ace tall:(vang & paf))))
(stag %rvar ;~(pfix ;~(plug tis tis) sym))
(stag %hoon tall:(vang & paf))
==
::
@ -158,7 +153,7 @@
:~ :^ ost %pass /child/[cil]/main
:+ %g %meta !>
:* %mess [our.hid cil imp.hid] you
(cat 3 p.u.com '-args') (run [%clsg q.u.com])
(cat 3 p.u.com '-args') (slap seeb [%clsg q.u.com])
==
[ost %pass /child/[cil]/out %g %show [our.hid cil imp.hid] you /out]
[ost %pass /child/[cil] %g %sire p.u.com cil] :: XX strange order?
@ -194,33 +189,23 @@
:~ :^ ost %pass /child/[cia]/main
:+ %g %meta !>
:* %mess [our.hid cia imp.hid] you
(cat 3 p.u.com '-args') (run [%clsg q.u.com])
(cat 3 p.u.com '-args') (slap seeb [%clsg q.u.com])
==
:^ ost %pass /child/[cib]/main
:+ %g %meta !>
:* %mess [our.hid cib imp.hid] you
(cat 3 r.u.com '-args') (run [%clsg s.u.com])
(cat 3 r.u.com '-args') (slap seeb [%clsg s.u.com])
==
[ost %pass /child/[cia]/out %g %show [our.hid cia imp.hid] you /out]
[ost %pass /child/[cia] %g %sire p.u.com cia] :: XX strange order?
[ost %pass /child/[cib]/out %g %show [our.hid cib imp.hid] you /out]
[ost %pass /child/[cib] %g %sire r.u.com cib]
[ost %pass /child/[cib] %g %sire r.u.com cib] :: XX strange order?
(print ost you leaf/"running {(trip p.u.com)} into {(trip r.u.com)}" ~)
==
::
%var
:_ +>.$(var (~(put by var) p.u.com (run %ktts p.u.com q.u.com)))
:- (print ost you leaf/"created variable '{(trip p.u.com)}'" ~)
[ost %give %nice ~]~
::
%rvar
:_ +>.$(var (~(del by var) p.u.com))
:- (print ost you leaf/"deleted variable '{(trip p.u.com)}'" ~)
[ost %give %nice ~]~
::
%hoon
:_ +>.$
:~ (print ost you (sell (run p.u.com)) ~)
:~ (print ost you (sell (slap seeb p.u.com)) ~)
[ost %give %nice ~]
==
==
@ -273,14 +258,6 @@
%term-line (slop !>(pro) tan)
==
::
++ run
|= gen=twig
%- slap :_ gen
%+ roll (~(tap by var))
=< .(q seeb)
|= [[term v=vase] q=vase]
(slop v q)
::
++ spam
|= [pax=path gip=gift]
^- (list move)

View File

@ -39,7 +39,7 @@
== == ==
--
::
::::
:::: libs
::
|%
++ encode
@ -116,7 +116,9 @@
})
$(prom).focus()
$(prem).on('click', function() { $(prom).focus(); })
urb.subscribe({path: '/lines' + urb.term.pax}, function(e, dat){
var pax = '/lines'
if(urb.term.pax != "/") pax += urb.term.pax
urb.subscribe({path: pax}, function(e, dat){
if(dat.data.ok) return;
cont.textContent = dat.data.lines.join('\n')
prem.textContent = dat.data.prompt + '> '
@ -143,7 +145,8 @@
[~ q.tel]
:- [ost %pass hi/mar/pax %g %sire [aut (encode aut t.pax)]]~
:_(q.tel leaf/"+ {(trip aut)}")
:_ +>.$(hiz (~(put by hiz) t.pax tel))
=. hiz (~(put by hiz) pax tel)
:_ +>.$
[[ost %give %rust %hymn (page t.pax)] mof]
==
::
@ -162,9 +165,10 @@
[~ q.tel]
:_ :_(q.tel leaf/"- {(trip p.jof)}")
[ost %pass hi/mar/pax %g %cide (encode p.jof pax)]~
~& poke-sire/jof
::~& poke-sire/[jof cub.hid]
=. q.tel :_(q.tel leaf/"+ {(trip p.jof)}")
:_ +>.$(hiz (~(put by hiz) pax tel))
=. hiz (~(put by hiz) pax tel)
:_ +>.$
%+ welp mof
:+ [ost %give %nice ~]
[ost %pass hi/mar/pax %g %sire [p.jof (encode p.jof pax)]]
@ -172,7 +176,8 @@
::
%line
=. q.tel :_(q.tel leaf/"{(trip p.tel)}> {(trip p.jof)}")
:_ +>.$(hiz (~(put by hiz) pax tel))
=. hiz (~(put by hiz) pax tel)
:_ +>.$
%+ murn (~(tap by cub.hid))
|= [p=span q=term]
?. =(pax q:(decode p)) ~
@ -183,6 +188,7 @@
++ jell
|= [a=bone b=path]
[a %give %rust %json (tel-to-jon (fall (~(get by hiz) b) *term-line))]
::
++ spam
|= pax=path
%+ murn
@ -190,14 +196,16 @@
|= [ost=bone @ paf=path]
?. =([%lines pax] paf) ~
(some (jell ost pax))
::
++ poke-term-line
|= [ost=bone you=ship tel=term-line]
^- [(list move) _+>]
~& tel-poke/tel
::~& tel-poke/tel
=| pax=path :: XX subscriptions
=+ tol=(fall (~(get by hiz) pax) *term-line)
=. tol [p.tel (weld q.tel q.tol)]
:_ +>.$(hiz (~(put by hiz) pax tol))
=. hiz (~(put by hiz) pax tol)
:_ +>.$
:- [ost %give %nice ~]
(spam pax)
::
@ -218,7 +226,8 @@
?~ p.sih ~
:- leaf/(trip p.u.p.sih)
(flop q.u.p.sih)
:_ +>.$(hiz (~(put by hiz) |2.pax tel))
=. hiz (~(put by hiz) pax tel)
:_ +>.$
:- [ost %give +.sih]
?:(=(old q.tel) ~ (spam pax))
::