mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 01:52:42 +03:00
Parser refactored, pipes work modulo subscribe order
This commit is contained in:
parent
b4c4ae6ce2
commit
1b66ae320c
@ -22,6 +22,7 @@
|
|||||||
++ pour
|
++ pour
|
||||||
|= [ost=bone pax=path sih=*]
|
|= [ost=bone pax=path sih=*]
|
||||||
=+ sih=;;(sign sih)
|
=+ sih=;;(sign sih)
|
||||||
|
~& grep-por/[pax sih]
|
||||||
?^ pax `+>.$
|
?^ pax `+>.$
|
||||||
:_ +>.$
|
:_ +>.$
|
||||||
?- &2.sih
|
?- &2.sih
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
::
|
::
|
||||||
/? 314
|
/? 314
|
||||||
/- term-line
|
/- term-line
|
||||||
/= seeb /~ !>(.)
|
/= pit /~ !>(.) :: kernel vase
|
||||||
::
|
::
|
||||||
:::: structures
|
:::: structures
|
||||||
::
|
::
|
||||||
@ -32,12 +32,8 @@
|
|||||||
[%meta p=vase] ::
|
[%meta p=vase] ::
|
||||||
== == == ::
|
== == == ::
|
||||||
++ mand ,[p=term q=(list twig)] ::
|
++ mand ,[p=term q=(list twig)] ::
|
||||||
++ pipa ::
|
|
||||||
$% [%pipe p=mand q=pipa] ::
|
|
||||||
[%start mand] ::
|
|
||||||
== ::
|
|
||||||
++ coma ::
|
++ coma ::
|
||||||
$? pipa ::
|
$% [%run p=(list mand) q=mand] :: pipe into
|
||||||
[%end p=(each ,@u cord)] ::
|
[%end p=(each ,@u cord)] ::
|
||||||
[%path p=path] ::
|
[%path p=path] ::
|
||||||
[%hoon p=twig] ::
|
[%hoon p=twig] ::
|
||||||
@ -56,6 +52,52 @@
|
|||||||
== == == ::
|
== == == ::
|
||||||
--
|
--
|
||||||
!:
|
!:
|
||||||
|
:::: parsers
|
||||||
|
::
|
||||||
|
|%
|
||||||
|
++ maybe |*(fel=_rule (cook |*(a=(unit) (fall a ~)) (opts fel)))
|
||||||
|
++ opts
|
||||||
|
|* fel=_rule
|
||||||
|
;~ pose
|
||||||
|
(cook some fel)
|
||||||
|
(easy ~)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ from
|
||||||
|
=+ tol=`?(0 1 2)`%2
|
||||||
|
|_ [pax=path lat=time]
|
||||||
|
++ rail
|
||||||
|
|* [wid=_rule wif=_rule tal=_rule]
|
||||||
|
?~ tol wid
|
||||||
|
;~ pose wid
|
||||||
|
?: ?=(1 tol) wif
|
||||||
|
;~(pose wif tal)
|
||||||
|
==
|
||||||
|
::
|
||||||
|
++ parse
|
||||||
|
^- $+(nail (like coma))
|
||||||
|
=+ paf=pax
|
||||||
|
=. pax ?.(=('0' &3.pax) pax pax(&3 (scot da/lat)))
|
||||||
|
;~ pose
|
||||||
|
(stag %run ;~(plug (star ;~(sfix (comd(tol %0) bar) ace)) (comd col)))
|
||||||
|
(stag %end ;~(pfix sem ;~(pose (stag %& dem) (stag %| sym))))
|
||||||
|
(stag %path (sear plex rood):(vang & paf))
|
||||||
|
(stag %var ;~(plug ;~(pfix tis sym) ;~(pfix ace tall:(vang & pax))))
|
||||||
|
(stag %rvar ;~(pfix ;~(plug tis tis) sym))
|
||||||
|
(stag %hoon tall:(vang & pax))
|
||||||
|
==
|
||||||
|
++ args
|
||||||
|
=+ wid=wide:(vang & pax)
|
||||||
|
%^ rail
|
||||||
|
(ifix sel^ser (most ace wid))
|
||||||
|
(plus ;~(pfix ace wid))
|
||||||
|
;~(sfix (plus ;~(pfix gap tall:(vang & pax))) ;~(plug gap duz))
|
||||||
|
::
|
||||||
|
++ comd |*(fel=_rule ;~(pfix fel ;~(plug sym (maybe args))))
|
||||||
|
::
|
||||||
|
--
|
||||||
|
--
|
||||||
|
!:
|
||||||
:::: program
|
:::: program
|
||||||
::
|
::
|
||||||
|_ $: hid=hide
|
|_ $: hid=hide
|
||||||
@ -66,44 +108,6 @@
|
|||||||
pop=(map span span)
|
pop=(map span span)
|
||||||
var=(map term vase)
|
var=(map term vase)
|
||||||
==
|
==
|
||||||
++ maybe
|
|
||||||
|* fel=_rule
|
|
||||||
;~ pose
|
|
||||||
fel
|
|
||||||
(easy ~)
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ args
|
|
||||||
:: ^- $+(nail (like (list twig)))
|
|
||||||
(more ace wide:(vang & pax))
|
|
||||||
::
|
|
||||||
++ pipe
|
|
||||||
%+ knee *[mand pipa] |. ~+
|
|
||||||
;~ pfix bar
|
|
||||||
;~ plug
|
|
||||||
;~(plug sym (maybe (ifix [;~(plug ace sel) ser] args)))
|
|
||||||
;~(pfix ace pipable)
|
|
||||||
==
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ pipable
|
|
||||||
%+ knee *pipa |. ~+
|
|
||||||
;~ pose
|
|
||||||
(stag %start ;~(pfix col ;~(plug sym (maybe ;~(pfix ace args)))))
|
|
||||||
(stag %pipe pipe)
|
|
||||||
==
|
|
||||||
::
|
|
||||||
++ parse
|
|
||||||
^- $+(nail (like coma))
|
|
||||||
=+ paf=?.(=('0' &3.pax) pax pax(&3 (scot da/lat.hid)))
|
|
||||||
;~ pose
|
|
||||||
pipable(pax paf)
|
|
||||||
(stag %end ;~(pfix sem ;~(pose (stag %& dem) (stag %| sym))))
|
|
||||||
(stag %path (sear plex rood):(vang & pax))
|
|
||||||
(stag %var ;~(plug ;~(pfix tis sym) ;~(pfix ace tall:(vang & paf))))
|
|
||||||
(stag %rvar ;~(pfix ;~(plug tis tis) sym))
|
|
||||||
(stag %hoon tall:(vang & paf))
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
++ peer
|
++ peer
|
||||||
|= [ost=bone you=ship pax=path]
|
|= [ost=bone you=ship pax=path]
|
||||||
@ -127,14 +131,16 @@
|
|||||||
^- (list span)
|
^- (list span)
|
||||||
%+ murn (~(tap by sup.hid))
|
%+ murn (~(tap by sup.hid))
|
||||||
|= [@ @ a=path]
|
|= [@ @ a=path]
|
||||||
?. ?=([%in cord ~] a) ~
|
?. ?& ?=([%in cord ~] a)
|
||||||
?. (~(has by cub.hid) i.t.a) ~
|
(~(has by cub.hid) i.t.a)
|
||||||
|
!(~(has by pop) i.t.a)
|
||||||
|
==
|
||||||
|
~
|
||||||
(some i.t.a)
|
(some i.t.a)
|
||||||
::
|
::
|
||||||
++ poke-txt
|
++ poke-txt
|
||||||
|= [ost=bone you=ship txt=cord]
|
|= [ost=bone you=ship txt=cord]
|
||||||
^- [(list move) _+>]
|
^- [(list move) _+>]
|
||||||
=| inp=(unit span)
|
|
||||||
?: =('\\' (end 3 1 txt))
|
?: =('\\' (end 3 1 txt))
|
||||||
?+ (rsh 3 1 txt)
|
?+ (rsh 3 1 txt)
|
||||||
:_ +>.$
|
:_ +>.$
|
||||||
@ -152,7 +158,8 @@
|
|||||||
:_ +>.$
|
:_ +>.$
|
||||||
:- [ost %give %nice ~]
|
:- [ost %give %nice ~]
|
||||||
(print ost you ~)
|
(print ost you ~)
|
||||||
%l =+ =- tak=rose/[" " "[" "]"]^(turn cubs -)
|
%l ~& [pip pop]
|
||||||
|
=+ =- tak=rose/[" " "[" "]"]^(turn cubs -)
|
||||||
|= a=span
|
|= a=span
|
||||||
leaf/(trip (rap 3 (~(got by cub.hid) a) '(' a ')' ~))
|
leaf/(trip (rap 3 (~(got by cub.hid) a) '(' a ')' ~))
|
||||||
[[[ost give/nice/~] (print ost you tak ~)] +>.$]
|
[[[ost give/nice/~] (print ost you tak ~)] +>.$]
|
||||||
@ -170,77 +177,70 @@
|
|||||||
(print:con ost you tak ~)
|
(print:con ost you tak ~)
|
||||||
[[ost %give %nice ~] mof]
|
[[ost %give %nice ~] mof]
|
||||||
^- [con=_+>.$ tak=$|(~ tank) mof=(list move)]
|
^- [con=_+>.$ tak=$|(~ tank) mof=(list move)]
|
||||||
=+ com=(rush txt parse)
|
=+ pas=((full ~(parse from pax lat.hid)) [1 1] (trip txt))
|
||||||
?~ com
|
?~ q.pas
|
||||||
[+>.$ leaf/"Clarify {(trip txt)}" ~]
|
[+>.$ leaf/"<syntax error at {<`[@ @]`p.pas>}>" ~]
|
||||||
|- ^- [con=_+>.^$ tak=$|(~ tank) mof=(list move)]
|
=+ com=(wonk pas)
|
||||||
?- -.u.com
|
^- [con=_+>.$ tak=$|(~ tank) mof=(list move)]
|
||||||
|
?- -.com
|
||||||
%path
|
%path
|
||||||
=. pax p.u.com
|
=. pax p.com
|
||||||
[+>.^$ leaf/"=% {(spud p.u.com)}" ~]
|
[+>.$ leaf/"=% {(spud p.com)}" ~]
|
||||||
::
|
::
|
||||||
%start
|
%run
|
||||||
|
=+ mof=(print ost you leaf/"+ :{(trip p.q.com)}" ~)
|
||||||
|
=| inp=(unit span)
|
||||||
|
=< [+>.$ ~ mof]
|
||||||
|
%+ roll
|
||||||
|
`(list mand)`(welp p.com q.com ~)
|
||||||
|
=+ a=[app=*mand .]
|
||||||
|
|.
|
||||||
|
=> a
|
||||||
=+ cil=(scot %ud pid)
|
=+ cil=(scot %ud pid)
|
||||||
=. pid +(pid)
|
::~& [%pipsqueak <p.com> <q.com>]
|
||||||
=. pip ?~ inp pip (~(put by pip) u.inp cil)
|
=: pid +(pid)
|
||||||
=. pop ?~ inp pip (~(put by pop) cil u.inp)
|
pip ?~ inp pip (~(put by pip) u.inp cil)
|
||||||
=. inp ~
|
pop ?~ inp pop (~(put by pop) cil u.inp)
|
||||||
:- +>.^$ :- ~
|
inp `cil
|
||||||
:* :^ ost %pass /child/[cil]/main
|
==
|
||||||
:+ %g %meta !>
|
~& shelling/[inp pip pop]
|
||||||
:* %mess [our.hid cil imp.hid] you
|
%_ +>
|
||||||
(cat 3 p.u.com '-args') (run [%clsg q.u.com])
|
mof
|
||||||
==
|
=+ yon=[our.hid cil imp.hid]
|
||||||
[ost %pass /child/[cil]/out %g %show [our.hid cil imp.hid] you /out]
|
=+ mez=[(cat 3 p.app '-args') (exec [%clsg q.app])]
|
||||||
[ost %pass /child/[cil] %g %sire p.u.com cil] :: XX strange order?
|
=- (weld (flop -) mof) :: XX strange order
|
||||||
(print ost you leaf/"+ :{(trip p.u.com)}" ~)
|
^- (list move)
|
||||||
|
:~ [ost %pass /child/[cil] %g %sire p.app cil]
|
||||||
|
[ost %pass /child/[cil]/out %g %show yon you /out]
|
||||||
|
[ost %pass /child/[cil]/main %g %meta !>([%mess yon you mez])]
|
||||||
|
==
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
%end
|
%end
|
||||||
?: ?=(%& -.p.u.com)
|
?: ?=(%& -.p.com)
|
||||||
=+ cil=(scot %ud p.p.u.com)
|
=+ cil=(scot %ud p.p.com)
|
||||||
=+ cin=(trip (~(got by cub.hid) cil))
|
=+ cin=(trip (~(got by cub.hid) cil))
|
||||||
:- +>.^$ :- ~
|
:- +>.$ :- ~
|
||||||
:_ (print ost you leaf/"- :{cin}({(trip cil)})" ~)
|
:_ (print ost you leaf/"- :{cin}({(trip cil)})" ~)
|
||||||
[ost %pass /child/[cil] %g %cide cil]
|
[ost %pass /child/[cil] %g %cide cil]
|
||||||
=* cil p.p.u.com
|
=* cil p.p.com
|
||||||
=- [+>.^$ leaf/"-{<(lent moz)>} :{(trip cil)}" moz]
|
=- [+>.$ leaf/"-{<(lent moz)>} :{(trip cil)}" moz]
|
||||||
^= moz
|
^= moz
|
||||||
%+ murn (~(tap by cub.hid)) |= [a=span b=term]
|
%+ murn (~(tap by cub.hid)) |= [a=span b=term]
|
||||||
?. =(b cil) ~
|
?. =(b cil) ~
|
||||||
%- some
|
%- some
|
||||||
[ost %pass /child/[a] %g %cide a]
|
[ost %pass /child/[a] %g %cide a]
|
||||||
::
|
|
||||||
%pipe
|
|
||||||
~& [%pipsqueak <p.u.com> <q.u.com>]
|
|
||||||
=+ cil=(scot %ud pid)
|
|
||||||
=. pid +(pid)
|
|
||||||
=. pip ?~ inp pip (~(put by pip) u.inp cil)
|
|
||||||
=. pop ?~ inp pip (~(put by pop) cil u.inp)
|
|
||||||
=. inp `cil
|
|
||||||
=+ nex=$(u.com q.u.com)
|
|
||||||
:: =. +>.^$ con.nex XX whu??
|
|
||||||
:+ con.nex tak.nex
|
|
||||||
%- welp :_ mof.nex
|
|
||||||
:~ :^ ost %pass /child/[cil]/main
|
|
||||||
:+ %g %meta !>
|
|
||||||
:* %mess [our.hid cil imp.hid] you
|
|
||||||
(cat 3 p.p.u.com '-args') (run [%clsg q.p.u.com])
|
|
||||||
==
|
|
||||||
[ost %pass /child/[cil]/out %g %show [our.hid cil imp.hid] you /out]
|
|
||||||
[ost %pass /child/[cil] %g %sire p.p.u.com cil]
|
|
||||||
==
|
|
||||||
::
|
::
|
||||||
%var
|
%var
|
||||||
=. var (~(put by var) p.u.com (run q.u.com))
|
=. var (~(put by var) p.com (exec q.com))
|
||||||
[+>.^$ leaf/"created variable '{(trip p.u.com)}'" ~]
|
[+>.$ leaf/"created variable '{(trip p.com)}'" ~]
|
||||||
::
|
::
|
||||||
%rvar
|
%rvar
|
||||||
=. var (~(del by var) p.u.com)
|
=. var (~(del by var) p.com)
|
||||||
[+>.^$ leaf/"deleted variable '{(trip p.u.com)}'" ~]
|
[+>.$ leaf/"deleted variable '{(trip p.com)}'" ~]
|
||||||
::
|
::
|
||||||
%hoon
|
%hoon
|
||||||
[+>.^$ (sell (run p.u.com)) ~]
|
[+>.$ (sell (exec p.com)) ~]
|
||||||
==
|
==
|
||||||
::
|
::
|
||||||
++ purr
|
++ purr
|
||||||
@ -283,6 +283,9 @@
|
|||||||
!>([(sell (slot 15 [typ sih]))]~)
|
!>([(sell (slot 15 [typ sih]))]~)
|
||||||
%tang
|
%tang
|
||||||
(slot 15 [typ sih])
|
(slot 15 [typ sih])
|
||||||
|
%txt
|
||||||
|
?^ q.sih !! :: move to vase space?
|
||||||
|
!>([leaf/(trip q.sih)]~)
|
||||||
==
|
==
|
||||||
== ==
|
== ==
|
||||||
::
|
::
|
||||||
@ -307,11 +310,11 @@
|
|||||||
?. =('0' &3.pax)
|
?. =('0' &3.pax)
|
||||||
(spat pax)
|
(spat pax)
|
||||||
(rap 3 '/' &1.pax '/' &2.pax '=' ?~(|3.pax ~ [(spat |3.pax)]~))
|
(rap 3 '/' &1.pax '/' &2.pax '=' ?~(|3.pax ~ [(spat |3.pax)]~))
|
||||||
++ run
|
++ exec
|
||||||
|= gen=twig
|
|= gen=twig
|
||||||
%- slap :_ gen
|
%- slap :_ gen
|
||||||
%+ roll (~(tap by var))
|
%+ roll (~(tap by var))
|
||||||
=< .(q seeb)
|
=< .(q pit)
|
||||||
|= [[n=term v=vase] q=vase]
|
|= [[n=term v=vase] q=vase]
|
||||||
(slop [[%face n p.v] q.v] q)
|
(slop [[%face n p.v] q.v] q)
|
||||||
::
|
::
|
||||||
|
Loading…
Reference in New Issue
Block a user