urbit/pkg/arvo/ted/graph/eval.hoon
2020-12-11 15:52:17 +10:00

37 lines
880 B
Plaintext

/- spider, graph=graph-store
/+ strandio, resource, graph-view
::
=, strand=strand:spider
^- thread:spider
|= arg=vase
=/ m (strand ,vase)
^- form:m
=+ !<([~ =action:graph-view] arg)
?> ?=(%eval -.action)
;< =bowl:spider bind:m get-bowl:strandio
=/ ast=(unit hoon)
(rush cord.action vest)
?~ ast
(pure:m !>(`tang`[%leaf "Syntax Error"]~))
=/ fowl=[our=@p now=@da eny=@uvJ]
:+ our.bowl
now.bowl
(shaz (cat 3 (mix [now eny]:bowl) %eny))
::
=/ subject [fowl ..zuse]
=/ minted=(each [=type =nock] (list tank))
%- mule |.
(~(mint ut -:!>(subject)) %noun u.ast)
?: ?=(%| -.minted) (pure:m !>(p.minted))
=/ =toon
(mock [subject nock.p.minted] |=(^ ~))
%- pure:m
!> ^- tang
?- -.toon
%0 [(sell type.p.minted p.toon) ~]
%1 :- leaf+".^ unsupported in chat eval"
(turn ;;((list path) p.toon) smyt)
%2 [leaf+"crash!" p.toon]
==