Merge branch 'barbus' (#1712)

* barbus:
  hoon: removed unused parser type
  hoon: remove extraneous cast
  hoon: removed barhax. No hax!
  hoon: replace barhax with barbus
  hoon: changed barbus to match barhax
  hoon: replaced barbus usage with barhax
  hoon: add parsing for barhax
  hoon: added barhax to replace barbus
  hoon: update tall parsing for |$
  hoon: replace +* name usage with ++  name  |$
  hoon: add parsing rules for |$
  hoon: add ast for |$
This commit is contained in:
Jared Tobin 2019-09-11 15:27:04 -02:30
commit 472c27ef6c
No known key found for this signature in database
GPG Key ID: 0E4647D58F8A69E4
5 changed files with 73 additions and 27 deletions

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:7bf18a0a70e3eb66edf08c49ee57de7551c6894cf2e04a7b93a46109e31d7c73 oid sha256:bb0a7faca368603e55469035da0deae500a0ad69c9858699a49118f8310b16b2
size 11254785 size 12603952

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:0b34cfea64cdaf45ef0206cbed7909d1c54979a17eeb01306b850bb8b62ecb5c oid sha256:535dc0cc1993506c6a32d2c4d169871329bb77459f352c96681a414261c17e7e
size 6222454 size 7644344

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1 version https://git-lfs.github.com/spec/v1
oid sha256:8a7e4e38aa07657b7376fea2bc26d85093294f26f008620cd43986b1427ec3ff oid sha256:8ac3be8c9544148e53d70f584476e9d2366159b31dd7474a9be02cccb9ac1d11
size 13951578 size 15294014

View File

@ -273,7 +273,8 @@
:: 8 bits. :: 8 bits.
@ @
:: ::
+* each [this that] ++ each
|$ [this that]
:: either {a} or {b}, defaulting to {a}. :: either {a} or {b}, defaulting to {a}.
:: ::
:: mold generator: produces a discriminated fork between two types, :: mold generator: produces a discriminated fork between two types,
@ -291,7 +292,8 @@
:: sample type of `*`. :: sample type of `*`.
$-(* *) $-(* *)
:: ::
+* list [item] ++ list
|$ [item]
:: null-terminated list :: null-terminated list
:: ::
:: mold generator: produces a mold of a null-terminated list of the :: mold generator: produces a mold of a null-terminated list of the
@ -299,14 +301,16 @@
:: ::
$@(~ [i=item t=(list item)]) $@(~ [i=item t=(list item)])
:: ::
+* lone [item] ++ lone
|$ [item]
:: single item tuple :: single item tuple
:: ::
:: mold generator: puts the face of `p` on the passed in mold. :: mold generator: puts the face of `p` on the passed in mold.
:: ::
p=item p=item
:: ::
+* lest [item] ++ lest
|$ [item]
:: null-terminated non-empty list :: null-terminated non-empty list
:: ::
:: mold generator: produces a mold of a null-terminated list of the :: mold generator: produces a mold of a null-terminated list of the
@ -322,7 +326,8 @@
:: examples: * @ud ,[p=time q=?(%a %b)] :: examples: * @ud ,[p=time q=?(%a %b)]
$~(* $-(* *)) $~(* $-(* *))
:: ::
+* pair [head tail] ++ pair
|$ [head tail]
:: dual tuple :: dual tuple
:: ::
:: mold generator: produces a tuple of the two types passed in. :: mold generator: produces a tuple of the two types passed in.
@ -332,21 +337,24 @@
:: ::
[p=head q=tail] [p=head q=tail]
:: ::
+* pole [item] ++ pole
|$ [item]
:: faceless list :: faceless list
:: ::
:: like ++list, but without the faces {i} and {t}. :: like ++list, but without the faces {i} and {t}.
:: ::
$@(~ [item (pole item)]) $@(~ [item (pole item)])
:: ::
+* qual [first second third fourth] ++ qual
|$ [first second third fourth]
:: quadruple tuple :: quadruple tuple
:: ::
:: mold generator: produces a tuple of the four types passed in. :: mold generator: produces a tuple of the four types passed in.
:: ::
[p=first q=second r=third s=fourth] [p=first q=second r=third s=fourth]
:: ::
+* quip [item state] ++ quip
|$ [item state]
:: pair of list of first and second :: pair of list of first and second
:: ::
:: a common pattern in hoon code is to return a ++list of changes, along with :: a common pattern in hoon code is to return a ++list of changes, along with
@ -357,12 +365,14 @@
:: ::
[(list item) state] [(list item) state]
:: ::
+* trap [product] ++ trap
|$ [product]
:: a core with one arm `$` :: a core with one arm `$`
:: ::
_|?($:product) _|?($:product)
:: ::
+* tree [node] ++ tree
|$ [node]
:: tree mold generator :: tree mold generator
:: ::
:: a `++tree` can be empty, or contain a node of a type and :: a `++tree` can be empty, or contain a node of a type and
@ -370,14 +380,16 @@
:: ::
$@(~ [n=node l=(tree node) r=(tree node)]) $@(~ [n=node l=(tree node) r=(tree node)])
:: ::
+* trel [first second third] ++ trel
|$ [first second third]
:: triple tuple :: triple tuple
:: ::
:: mold generator: produces a tuple of the three types passed in. :: mold generator: produces a tuple of the three types passed in.
:: ::
[p=first q=second r=third] [p=first q=second r=third]
:: ::
+* unit [item] ++ unit
|$ [item]
:: maybe :: maybe
:: ::
:: mold generator: either `~` or `[~ u=a]` where `a` is the :: mold generator: either `~` or `[~ u=a]` where `a` is the
@ -1815,18 +1827,21 @@
:::: 2o: containers :: :::: 2o: containers ::
:: :: :: ::
:: ::
+* jar [key value] (map key (list value)) :: map of lists ++ jar |$ [key value] (map key (list value)) :: map of lists
+* jug [key value] (map key (set value)) :: map of sets ++ jug |$ [key value] (map key (set value)) :: map of sets
:: ::
+* map [key value] :: table ++ map
|$ [key value] :: table
$| (tree (pair key value)) $| (tree (pair key value))
|=(a=(tree (pair)) ~(apt by a)) |=(a=(tree (pair)) ~(apt by a))
:: ::
+* qeu [item] :: queue ++ qeu
|$ [item] :: queue
$| (tree item) $| (tree item)
|=(a=(tree) ~(apt to a)) |=(a=(tree) ~(apt to a))
:: ::
+* set [item] :: set ++ set
|$ [item] :: set
$| (tree item) $| (tree item)
|=(a=(tree) ~(apt in a)) |=(a=(tree) ~(apt in a))
:: ::
@ -6654,6 +6669,7 @@
{$yell p/(list hoon)} :: render as tank {$yell p/(list hoon)} :: render as tank
{$xray p/manx:hoot} :: ;foo; templating {$xray p/manx:hoot} :: ;foo; templating
:: :::::: cores :: :::::: cores
{$brbs sample/(lest term) body/spec} :: |$
{$brcb p/spec q/alas r/(map term tome)} :: |_ {$brcb p/spec q/alas r/(map term tome)} :: |_
{$brcl p/hoon q/hoon} :: |: {$brcl p/hoon q/hoon} :: |:
{$brcn p/(unit term) q/(map term tome)} :: |% {$brcn p/(unit term) q/(map term tome)} :: |%
@ -8630,6 +8646,13 @@
{$yell *} [%cncl [%limb %cain] [%zpbn [%cltr p.gen]] ~] {$yell *} [%cncl [%limb %cain] [%zpbn [%cltr p.gen]] ~]
{$note *} q.gen {$note *} q.gen
:: ::
{$brbs *} =- ?~ - !!
[%brtr [%bscl -] [%ktcl body.gen]]
%+ turn `(list term)`sample.gen
|= =term
^- spec
=/ tar [%base %noun]
[%bsts term [%bssg tar [%bshp tar tar]]]
{$brcb *} :+ %tsls [%kttr p.gen] {$brcb *} :+ %tsls [%kttr p.gen]
:+ %brcn ~ :+ %brcn ~
%- ~(run by r.gen) %- ~(run by r.gen)
@ -11909,8 +11932,8 @@
:: ::
+| %helpers +| %helpers
:: ::
+* batt-of [arm] (map term (pair what (map term arm))) ++ batt-of |$ [arm] (map term (pair what (map term arm)))
+* chap-of [arm] [doc=what arms=(map term arm)] ++ chap-of |$ [arm] [doc=what arms=(map term arm)]
:: ::
:: Traverse over a chapter in a battery. :: Traverse over a chapter in a battery.
:: ::
@ -16583,6 +16606,7 @@
['*' (rune tar %brtr exqc)] ['*' (rune tar %brtr exqc)]
['=' (rune tis %brts exqc)] ['=' (rune tis %brts exqc)]
['?' (rune wut %brwt expa)] ['?' (rune wut %brwt expa)]
['$' (rune bus %brbs exqe)]
== ==
== ==
:- '$' :- '$'
@ -16793,7 +16817,23 @@
== ==
== ==
== ==
:: :: parses a or [a b c] or a b c ==
++ lynx
=/ wid (ifix [lac rac] (most ace sym))
=/ tal
;~ sfix
(most gap sym)
;~(plug gap duz)
==
=/ one
%- cook :_ sym
|= a=term
`(list term)`~[a]
%- cook
:_ ;~(pose (runq wid tal) one)
:: lestify
|= a=(list term)
?~(a !! a)
++ whap !: :: chapter ++ whap !: :: chapter
%+ cook %+ cook
|= a=(list (pair term hoon)) |= a=(list (pair term hoon))
@ -16874,6 +16914,11 @@
|@ ++ $ |@ ++ $
;~(pfix dif (stag hil (stag tuq (toad har)))) ;~(pfix dif (stag hil (stag tuq (toad har))))
-- --
++ runq :: wide or tall if tol
|* [wid/rule tal/rule] :: else wide
?. tol
wid
;~(pose wid tal)
:: ::
++ glop ~+((glue mash)) :: separated by space ++ glop ~+((glue mash)) :: separated by space
++ gunk ~+((glue muck)) :: separated list ++ gunk ~+((glue muck)) :: separated list
@ -16961,6 +17006,7 @@
++ exqb |.(;~(gunk loan loan)) :: two specs ++ exqb |.(;~(gunk loan loan)) :: two specs
++ exqc |.(;~(gunk loan loaf)) :: spec then hoon ++ exqc |.(;~(gunk loan loaf)) :: spec then hoon
++ exqd |.(;~(gunk loaf loan)) :: hoon then spec ++ exqd |.(;~(gunk loaf loan)) :: hoon then spec
++ exqe |.(;~(gunk lynx loan)) :: list of names then spec
++ exqs |.((butt hunk)) :: closed gapped specs ++ exqs |.((butt hunk)) :: closed gapped specs
++ exqg |.(;~(gunk sym loan)) :: term and spec ++ exqg |.(;~(gunk sym loan)) :: term and spec
++ exqk |.(;~(gunk loaf ;~(plug loan (easy ~)))) :: hoon with one spec ++ exqk |.(;~(gunk loaf ;~(plug loan (easy ~)))) :: hoon with one spec

View File

@ -6,7 +6,7 @@
+| %generics +| %generics
:: $mk-item: constructor for +ordered-map item type :: $mk-item: constructor for +ordered-map item type
:: ::
+* mk-item [key val] [key=key val=val] ++ mk-item |$ [key val] [key=key val=val]
:: +ordered-map: treap with user-specified horizontal order :: +ordered-map: treap with user-specified horizontal order
:: ::
:: Conceptually smaller items go on the left, so the item with the :: Conceptually smaller items go on the left, so the item with the