Slowly advancing %batz. Some translators, etc.

This commit is contained in:
C. Guy Yarvin 2014-06-04 14:24:01 -07:00
parent 85a7688693
commit b6f3e61344
10 changed files with 460 additions and 5 deletions

View File

@ -1,4 +1,4 @@
::
!:
:: batz (4b), shell
::
|= pit=vase
@ -1263,7 +1263,98 @@
::
++ call :: process move
|= [hen=duct hic=(hypo kiss)]
(take ~ hen hic)
^- [p=(list move) q=_..^$]
:: ~& [%batz-take -.q.hic [%tea tea] [%hen hen]]
=+ ska=(slod ski)
=+ sky=|=(* `(unit)`=+(a=(ska +<) ?~(a ~ ?~(u.a ~ [~ u.u.a]))))
?: ?=([%crud *] q.hic)
[[[hen [%slip %d %flog q.hic]] ~] ..^$]
?: ?=([%soft *] q.hic)
$(q.hic ((hard card) p.q.hic))
?: ?=(%wake -.q.hic)
=+ ^= fiy
=| fiy=(list ,[p=duct q=ship r=[p=@ud q=@ud r=wire]])
|- ^+ fiy
?~ dez fiy
=. fiy $(dez l.dez)
=. fiy $(dez r.dez)
|- ^+ fiy
?~ q.n.dez fiy
%= $
q.n.dez t.q.n.dez
fiy
|- ^+ fiy
?~ tem.q.i.q.n.dez fiy
=. fiy $(tem.q.i.q.n.dez l.tem.q.i.q.n.dez)
=. fiy $(tem.q.i.q.n.dez r.tem.q.i.q.n.dez)
?. (lte q.n.tem.q.i.q.n.dez now) fiy
[[p.n.dez p.i.q.n.dez p.n.tem.q.i.q.n.dez] fiy]
==
=| wam=(list move)
|- ^- [p=(list move) q=_..^^$]
?~ fiy [wam ..^^$]
=+ dos=(need (~(get by dez) p.i.fiy))
=+ suy=|-(`brad`?~(dos !! ?.(=(q.i.fiy p.i.dos) $(dos t.dos) q.i.dos)))
=+ geb=((be [[q.i.fiy bred] suy]) now eny sky)
=+ ^= yub ^- [p=(list move) q=brat]
?. (fang:geb r.i.fiy)
~& [%time-lost r.i.fiy]
[~ abet:(flub:geb r.i.fiy)]
(lake:geb p.i.fiy r.i.fiy)
%= $
fiy t.fiy
wam (weld p.yub wam)
dez.^^$ (~(put by dez.^^$) p.i.fiy [[q.i.fiy +.q.yub] +.dos])
==
|- ^- [p=(list move) q=_..^^$]
=+ dus=(~(get by dez) hen)
?~ dus
?+ -.q.hic
~& [%take-none -.q.hic ~ hen]
~|([%take-none -.q.hic] !!)
::
%hail
?~ big
~& [%take-hail-soon hen]
[~ ..^^$]
~& [%batz-hack-console hen]
$(dez (~(put by dez) hen [[u.big (bard u.big)] ~]))
::
%init
:: ~& [%take-init p.q.hic hen]
=. big ?~ big
`p.q.hic
`(min p.q.hic u.big)
=+ bos=(sein p.q.hic)
:- :- [hen [%give q.hic]]
?: =(bos p.q.hic) ~
:_ ~
[hen [%slip %b %line (rap 3 ":{(scow %p bos)}/main=/bin/update")]]
..^^$(dez (~(put by dez) hen [[p.q.hic (bard p.q.hic)] ~]))
::
?(%loin %make %sith)
[[[hen [%toss %a ~ q.hic]] ~] ..^^$]
==
?> ?=(^ u.dus)
?+ -.q.hic
=+ beg=`brat`[[p.i.u.dus bred] q.i.u.dus]
=+ yub=(leap:((be beg) now eny sky) ~ hen q.hic)
:- p.yub
..^^$(dez (~(put by dez) hen [[p.i.u.dus +.q.yub] t.u.dus]))
::
%init
=+ bos=(sein p.q.hic)
:- :* [hen %give q.hic]
[[[%b ~] hen] [%sick %hail ~]]
?: =(bos p.q.hic) ~
:_ ~
[[/b hen] [%sick %line (rap 3 ":{(scow %p bos)}/main=/bin/update")]]
==
..^^$(dez (~(put by dez) hen [[p.q.hic (bard p.q.hic)] u.dus]))
::
%limn
$(q.hic [%hail ~], dez (~(put by dez) hen (weld t.u.dus `brim`[i.u.dus ~])))
==
::
++ doze
|= [now=@da hen=duct]

View File

@ -10,6 +10,7 @@
== ::
++ kiss :: in request ->$
$% [%born ~] :: new unix process
[%crud p=@tas q=(list tank)] :: XX rethink
[%init p=@p] :: report install
[%them p=(unit hiss)] :: outbound request
[%they p=@ud q=httr] :: inbound response
@ -254,6 +255,8 @@
^+ +>
?- -.kyz
%born +>.$(ged hen) :: register external
%crud
+>.$(mow [[hen %slip %d %flog kyz] mow])
%init :: register ownership
%_ +>.$
hov ?~(hov [~ p.kyz] [~ (min u.hov p.kyz)])
@ -1175,6 +1178,7 @@
++ inch :: function built
|= [num=@ud mez=(each beet (list tank))]
^+ +>
~& [%inch num -.mez]
=+ pup=(~(get by q.rey) num)
?~ pup
~& [%inch-lost ses num mez]
@ -1583,21 +1587,23 @@
[~ pip(pez [%fin %wan 'Hello, world' ~])]
::
[%fud *]
?> ?=(%fun -.som.pip)
=+ ^= mog
?: ?=(%fun -.som.pip) r.som.pip
~
:_ +>.$
:- ~
%= pip
pez
^- pest
?- -.p.pez.pip
| =+ mad=(loga "server error" r.som.pip p.p.pez.pip)
| =+ mad=(loga "server error" mog p.p.pez.pip)
:- %fin
:- %raw
^- httr
:+ 500
~[content-type/'text/html']
[~ (tact (xmlt | mad ~))]
& [%fin (lofi r.som.pip (lopo q.p.p.pez.pip))]
& [%fin (lofi mog (lopo q.p.p.pez.pip))]
==
==
::

View File

@ -303,6 +303,7 @@
::
++ expo :: return gift
|= gef=gift
~& [%expo -.gef]
%_(+> mow :_(mow [hen %give gef]))
::
++ fade :: compile
@ -641,6 +642,7 @@
|% ::
++ call :: request
|= [hen=duct hic=(hypo (hobo kiss))]
~& [%ford-call (,@tas -.q.hic)]
=. hic =+ kyt=-:!>(q.hic) :: XX temporary
?: (~(nest ut kyt) | p.hic)
hic
@ -679,6 +681,7 @@
++ stay `axle`+>-.$
++ take :: response
|= [tea=wire hen=duct hin=(hypo sign)]
~& [%ford-take (,@tas -.q.hin)]
=. hin =+ kyn=-:!>(q.hin) :: XX temporary
?: (~(nest ut kyn) | p.hin)
hin

View File

@ -21,6 +21,7 @@
== ::
++ kiss :: in request ->$
$% [%cuff p=(unit cuff) q=kiss] :: controlled kiss
[%crud p=@tas q=(list tank)] :: XX rethink
[%mesh p=hasp q=path r=json] :: web message (json)
[%mess p=hasp q=cage] :: urbit message
[%mush p=hasp q=path r=cage] :: web message (mime)

View File

@ -0,0 +1,3 @@
|= rem=spur
~& [%html rem]
,@

View File

@ -0,0 +1,2 @@
|= *
,@

View File

@ -0,0 +1,3 @@
|= *
|= htm=@
[/text/html (met 3 htm) htm]

View File

@ -0,0 +1 @@
|=(* ,@)

View File

@ -0,0 +1,342 @@
!:
|= *
=> %= .
+
=> +
=>
|%
++ down
$& [p=down q=down]
$% [%$ p=tape]
[%code p=tape]
[%inco p=tape]
[%head p=haxe q=down]
[%link p=tape q=tape r=(unit tape)]
[%lord p=(list down)]
[%lund p=(list down)]
[%parg p=down]
[%quot p=down]
[%rong p=down]
[%emph p=down]
[%hrul ~]
[%html p=tape]
==
++ haxe
|= a=*
?@ a
?:(&(!=(0 a) (lth a 6)) a 6)
6
--
|%
++ cott
;~ pose
(shim 0 8)
(shim 11 37)
(shim 39 59)
(just `@`61)
(shim 63 95)
(shim 97 255)
==
++ copt
;~ pose
(shim 0 9)
(shim 11 37)
(shim 39 39)
(shim 43 59)
(just `@`61)
(shim 63 90)
(shim 94 94)
(shim 97 255)
==
++ urlc ;~(pose (shim 0 9) (shim 11 31) (shim 33 39) (shim 42 255))
++ uctt ;~(pose (shim 0 9) (shim 11 91) (shim 94 255))
++ uctc ;~(pose (shim 0 9) (shim 11 33) (shim 35 39) (shim 42 255))
++ htmc ;~(pose (shim 0 9) (shim 11 255))
++ escp (mask "\\`*_\{}[]()#+-.!")
++ escd ;~(pfix bas escp)
++ whit (mask (tape 9 32 ~))
++ dent ;~(pose (jest ' ') (just `@`9))
++ blan (cold ~ ;~(plug (star whit) (just `@`10)))
++ mcat (bend |=([a=tape b=tape] (some (weld a b))))
++ wcat |*(a=_rule (cook |=([a=tape b=tape] (weld a b)) a))
++ codt
%+ knee *tape |. ~+
;~ pose
(wcat ;~(plug (plus cott) codt))
(cook |=(a=tape (weld "&lt;" a)) ;~(pfix gal ;~(pose codt (easy ~))))
(cook |=(a=tape (weld "&gt;" a)) ;~(pfix gar ;~(pose codt (easy ~))))
(cook |=(a=tape (weld "&amp;" a)) ;~(pfix pam ;~(pose codt (easy ~))))
(plus cott)
==
++ inlt
%+ knee *tape |. ~+
;~ pose
;~(mcat (plus copt) inlt)
;~(mcat (plus escd) inlt)
;~ mcat
%- wcat
;~ plug
;~(plug gal (cook trip inle))
;~(sfix (wcat ;~(plug (star copt) (easy ">"))) gar)
==
inlt
==
;~ mcat
%- wcat
;~ plug
;~(plug gal fas (cook trip inle))
;~(sfix (wcat ;~(plug (star copt) (easy ">"))) gar)
==
inlt
==
;~ mcat
(wcat ;~(plug ;~(plug pam hax ;~(sfix (plus nud) sem)) (easy ";")))
inlt
==
;~ mcat
(wcat ;~(plug ;~(plug pam ;~(sfix (plus alf) sem)) (easy ";")))
inlt
==
(cook |=(a=tape (weld "&lt;" a)) ;~(pfix gal ;~(pose inlt (easy ~))))
(cook |=(a=tape (weld "&gt;" a)) ;~(pfix gar ;~(pose inlt (easy ~))))
(cook |=(a=tape (weld "&amp;" a)) ;~(pfix pam ;~(pose inlt (easy ~))))
==
++ kite
|= bud=(list ,@t)
|= tub=nail
|- ^- (like ,@t)
?@ bud
(fail tub)
=+ foo=((jest i.bud) tub)
?~ q.foo
$(bud t.bud)
foo
++ bloc
%+ knee *@t |. ~+
%- kite
:~ '<address>' '<article>' '<aside>' '<audio>' '<blockquote>'
'<canvas>' '<dd>' '<div>' '<dl>' '<fieldset>' '<figcaption>'
'<figure>' '<footer>' '<form>' '<h1>' '<h2>' '<h3>' '<h4>'
'<h5>' '<h6>' '<header>' '<hgroup>' '<hr>' '<noscript>'
'<ol>' '<output>' '<p>' '<pre>' '<section>' '<table>'
'<tfoot>' '<ul>' '<video>' '<style>'
==
++ inle
%+ knee *@t |. ~+
%- kite
:~ 'b' 'big' 'i' 'small' 'tt' 'abbr' 'acronym'
'cite' 'code' 'dfn' 'em' 'kbd' 'strong' 'samp'
'var' 'a' 'bdo' 'br' 'img' 'map' 'object' 'q'
'script' 'span' 'sub' 'sup' 'button' 'input'
'label' 'select' 'textarea' 'link'
==
++ htmb
%+ knee *tape |. ~+
%+ cook |=(a=(list tape) (reel a |=([p=tape q=tape] (weld p q))))
(plus (cook |=(a=tape (weld a "\0a")) ;~(sfix (plus htmc) (just '\0a'))))
++ blok
%+ knee *tape |. ~+
%+ cook |=(a=[tape tape] (weld a))
;~(plug (cook trip bloc) ;~(plug (just '\0a') htmb))
++ intt
%+ knee *down |. ~+
;~ pose
(ifix [(jest '**') (jest '**')] (stag %rong intt))
(ifix [(jest '__') (jest '__')] (stag %rong intt))
(ifix [tar tar] (stag %emph intt))
(ifix [cab cab] (stag %emph intt))
(ifix [tec tec] (stag %inco codt))
(stag %$ inlt)
link
(stag %$ ;~(plug tar (easy ~)))
(stag %$ ;~(plug cab (easy ~)))
(stag %$ ;~(plug pel (easy ~)))
(stag %$ ;~(plug per (easy ~)))
(stag %$ ;~(plug sel (easy ~)))
(stag %$ ;~(plug ser (easy ~)))
==
++ inli
|= tub=nail
^- (like down)
?~ q.tub
(fail tub)
?: |(=(i.q.tub 10) =(i.q.tub '>'))
(fail tub)
=+ ^= foo
;~ pose
dent
;~(plug (mask "+*-") (plus whit))
;~(plug dim:ag dot (plus whit))
==
=+ bar=(foo tub)
?~ q.bar
%-
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
;~(sfix (plus intt) (just `@`10))
tub
(fail tub)
++ parg
|= [a=@ b=@]
%+ knee *down |. ~+
;~ plug
inli
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
(plus ;~(plug (easy [%$ "\0a"]) (colk a b inli)))
==
++ link
%+ knee *down |. ~+
%+ stag %link
;~ plug
(ifix [sel ser] (plus ;~(pose uctt escd)))
;~(pfix pel (star ;~(pose urlc escd)))
;~ pose
%+ cook |=(a=tape (some a))
(ifix [ace per] (ifix [doq doq] (plus ;~(pose uctc escd))))
(cold ~ per)
==
==
++ barg
|= a=@
%+ knee *haxe |. ~+
;~ pfix (stun [a a] (jest '> '))
;~ pose
(cold 1 ;~(plug (plus tis) (star whit) (just `@`10)))
(cold 2 ;~(plug (plus hep) (star whit) (just `@`10)))
==
==
++ neck
%+ knee *[haxe down] |. ~+
;~ pose
;~(pfix (jest '######') (stag 6 ;~(pfix (star whit) inli)))
;~(pfix (jest '#####') (stag 5 ;~(pfix (star whit) inli)))
;~(pfix (jest '####') (stag 4 ;~(pfix (star whit) inli)))
;~(pfix (jest '###') (stag 3 ;~(pfix (star whit) inli)))
;~(pfix (jest '##') (stag 2 ;~(pfix (star whit) inli)))
;~(pfix (jest '#') (stag 1 ;~(pfix (star whit) inli)))
==
++ mark
|= p=tape
(scan p park)
++ hrul
%+ knee *down |. ~+
%+ sear
|=(a=(list tape) ?:((gte (lent (zing a)) 3) (some [%hrul ~]) ~))
;~ sfix
(more (star whit) ;~(pose (plus cab) (plus tar) (plus hep)))
(just `@`10)
==
++ colk
|* [a=@ b=@ fel=_rule]
;~(pfix (stun [a a] (jest '> ')) (stun [b b] dent) fel)
++ code
|= [a=@ b=@]
%+ knee *tape |. ~+
%+ cook weld
;~ plug
(ifix [dent (just '\0a')] codt)
%+ cook |=(a=(list tape) (reel a |=([p=tape q=tape] (weld p q))))
%- star
;~(plug (easy '\0a') (colk a b (ifix [dent (just '\0a')] codt)))
==
++ lelm
|= [a=@ b=@]
%+ knee *down |. ~+
;~ pose
inli
hrul
;~(pfix (just `@`10) (lmel a b))
==
++ lmel
|= [a=@ b=@]
%+ knee *down |. ~+
;~ pose
;~((bend) (stag %lund (plus (lulm a b))) (lmel a b))
;~((bend) (stag %lord (plus (lolm a b))) (lmel a b))
;~((bend) (stag %code (colk a b (code a b))) (lmel a b))
;~((bend) (stag %head (colk a b neck)) (lmel a b))
;~((bend) (stag %parg (colk a b (parg a b))) (lmel a b))
(colk a b inli)
(colk a b hrul)
;~(pfix (plus (colk a b blan)) (lmel a b))
==
++ lulm
|= [a=@ b=@]
%+ knee *down |. ~+
(colk a b ;~(pfix (mask "+*-") (plus whit) (lelm a +(b))))
++ lolm
|= [a=@ b=@]
%+ knee *down |. ~+
(colk a b ;~(pfix dim:ag dot (plus whit) (lelm a +(b))))
++ bark
|= a=@
%+ knee *down |. ~+
;~ pose
(stag %html blok)
(stag %lund (plus (lulm a 0)))
(stag %lord (plus (lolm a 0)))
(stag %code (colk a 0 (code a 0)))
(stag %head (colk a 0 neck))
%+ cook |=([a=down b=haxe] [%head b a])
(colk a 0 ;~(plug inli (barg a)))
(colk a 0 hrul)
(stag %parg (colk a 0 (parg a 0)))
(colk a 0 inli)
(cold [%$ ""] (colk a 0 (plus blan)))
==
++ dark
|= a=@
%+ knee *down |. ~+
|= tub=nail
^- (like down)
=+ vex=((cook lent (star (jest '> '))) tub)
?~ q.vex
vex
?: (lth p.u.q.vex a)
(fail tub)
?: (gth p.u.q.vex a)
(;~((bend) (stag %quot (dark +(a))) (dark a)) tub)
(;~((bend) (bark a) (dark a)) tub)
++ park
%+ knee *down |. ~+
%+ cook |=(a=(list down) (reel a |=([p=down q=down] [p q])))
;~(sfix (plus (dark 0)) (star blan))
++ appd
|= [p=@ q=@]
^- @
(cat 3 p q)
++ wtag
|= [a=@ b=@]
^- @
:(appd '<' a '>' b '</' a '>')
++ sett
|= [a=@ b=tape]
^- @
:(appd a '="' (rap 3 b) '"')
++ hark
|= a=down
^- @
?- a
[%$ *] (rap 3 p.a)
[%code *] (wtag 'pre' (wtag 'code' (rap 3 p.a)))
[%inco *] (wtag 'code' (rap 3 p.a))
[%head *] (wtag (cat 3 'h' (add '0' p.a)) (hark q.a))
[%link *]
?~ r.a
:(appd '<a ' (sett 'href' q.a) '>' (rap 3 p.a) '</a>')
:(appd '<a ' (sett 'href' q.a) ' ' (sett 'title' u.r.a) '>' (rap 3 p.a) '</a>')
[%lord *] (wtag 'ol' (reel (turn p.a |=(a=down (wtag 'li' (hark a)))) appd))
[%lund *] (wtag 'ul' (reel (turn p.a |=(a=down (wtag 'li' (hark a)))) appd))
[%parg *] (wtag 'p' (hark p.a))
[%quot *] (wtag 'blockquote' (hark p.a))
[%rong *] (wtag 'strong' (hark p.a))
[%emph *] (wtag 'em' (hark p.a))
[%hrul *] '<hr>'
[%html *] (rap 3 p.a)
^ (cat 3 (hark p.a) (hark q.a))
==
--
==
|= txt=@
=+ tpt=(trip txt)
=+ mdp=(mark tpt)
:(appd '<html><body>' (hark mdp) '</body></html>')

View File

@ -0,0 +1,3 @@
|= *
|= htm=@
[/text/html (met 3 htm) htm]