Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hoon, dojo: initial doccords release #5873

Merged
merged 141 commits into from
Jan 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
141 commits
Select commit Hold shift + click to select a range
cdaf23a
hoon: prefix and postfix doccords for ++ and +$
drbeefsupreme Feb 25, 2022
336817d
hoon: doccords for core chapters
drbeefsupreme Feb 25, 2022
0a3ec9a
hoon: doccords cleanup %note tag for +boog
drbeefsupreme Mar 1, 2022
41a796d
hoon: hook up $+ for shorthand type rendering
Fang- Mar 10, 2022
f08b613
hoon: populate label for %brcn doccords
drbeefsupreme Mar 14, 2022
0dc3498
hoon: change %brdt AST to support doccords label
drbeefsupreme Mar 14, 2022
6437005
hoon: populate %brpt doccords label
drbeefsupreme Mar 14, 2022
1c72ff6
Revert "hoon: change %brdt AST to support doccords label"
drbeefsupreme Mar 16, 2022
ff81189
hoon: doccords %brdt cleanup revert
drbeefsupreme Mar 16, 2022
c01732d
hoon: doccords wrap bar runes with %notes
drbeefsupreme Mar 16, 2022
2fa0bd3
squash! hoon: doccords wrap bar runes with %notes
drbeefsupreme Mar 16, 2022
37580fa
hoon: doccords for tisfas
drbeefsupreme Mar 18, 2022
e50635b
hoon: doccords wrap %rock %sand %wing %knit %bust
drbeefsupreme Mar 18, 2022
af7d381
doccords: finding and print doccords library
drbeefsupreme Mar 30, 2022
91aeb0f
doccords: more printing tools
drbeefsupreme Mar 30, 2022
1af2e8f
doccords: dprint library unwrapping hints
drbeefsupreme Mar 31, 2022
752182f
doccords: dprint fix default core arm printing
drbeefsupreme Mar 31, 2022
d9e44e9
doccords: dprint print core routine
drbeefsupreme Mar 31, 2022
f9dfb59
hoon: turn on hints for %noun types
drbeefsupreme Mar 31, 2022
a15711c
doccords: dprint fix crash on non-help %hint
drbeefsupreme Mar 31, 2022
edfcceb
doccords: dprint print overview
drbeefsupreme Mar 31, 2022
0c255c1
hoon: plug type leak in vase literals by properly burping %hint
joemfb Mar 25, 2022
f7f4b3e
hoon: preserve structural sharing by testing subject/product equality…
joemfb Mar 25, 2022
6a6078b
doccords: dprint core and chapter items
drbeefsupreme Apr 4, 2022
063e3ed
hoon: doccords dist. between arm-doc and prod-doc
drbeefsupreme Apr 5, 2022
eb4b996
doccords: dprint can dist. arm-doc and prod-doc
drbeefsupreme Apr 5, 2022
151608d
doccords: dprint fix depth calculation
drbeefsupreme Apr 5, 2022
6f32d10
hoon: doccords wrap tisfas fix
drbeefsupreme Apr 5, 2022
37a7879
doccords: dprint refactoring and renaming
drbeefsupreme Apr 5, 2022
3afc9b6
doccords: dprint all docs in %arm items from type
drbeefsupreme Apr 5, 2022
69399c4
doccords: remove unwrap-note from dprint
drbeefsupreme Apr 5, 2022
877fe00
dojo: add command to lookup doccords
drbeefsupreme Apr 6, 2022
912a502
doccords: flop order of +print-arm results
drbeefsupreme Apr 6, 2022
33b2761
doccords, dojo: move flop print-arm -> dy-inspect
drbeefsupreme Apr 6, 2022
2a57e85
hoon: comment out %note entry in +open
drbeefsupreme Apr 6, 2022
0e8cf3b
doccords: dprint improve default arm core docs
drbeefsupreme Apr 6, 2022
7a94319
dojo, doccords: dprint library can take list term
drbeefsupreme Apr 6, 2022
7d8fabe
doccords: dprint remove +shallow-match
drbeefsupreme Apr 7, 2022
b41b22a
doccords: dprint fix chapter printing
drbeefsupreme Apr 7, 2022
b023008
doccords: dprint chapter and overview print tweak
drbeefsupreme Apr 7, 2022
24a175a
dojo: flop order of topics for dy-inspect
drbeefsupreme Apr 7, 2022
dd71b7c
doccords: dprint debug printfs
drbeefsupreme Apr 7, 2022
3d701f7
doccords: unit tests for arm dox
drbeefsupreme May 9, 2022
715d0f3
doccords: unit test for core dox
drbeefsupreme May 9, 2022
959906e
doccords: unit test for chapter dox
drbeefsupreme May 9, 2022
39ac7cb
Merge branch 'master' into jon/doccords
Jun 7, 2022
3d3ea61
hoon: %brcn and %brpt names for doccords
Jun 7, 2022
7e0d16d
dprint: new core naming syntax
Jun 7, 2022
6e02e35
dprint: fix issues with core types
Jun 8, 2022
0972c85
dprint: arms calling other arms dont steal doccord
Jun 8, 2022
a3ddde7
dprint: compile default arm in core against core
Jun 8, 2022
605960e
dprint: simplify and fix core/chapter/arm search
Jun 9, 2022
f7d0d3e
dprint: missed |^ in last commit
Jun 9, 2022
693226b
dprint: deduplicate role of +signify
Jun 9, 2022
62716ff
dprint: name core containing types
Jun 9, 2022
f31a9ed
dprint: swap expected<->actual order in unit tests
Jun 9, 2022
a59bd02
hoon: doccords, product-docs arent made in +boog
Jun 9, 2022
8f0bc30
dprint: help from hint uses second type, pass test
Jun 9, 2022
832d483
dprint: cleanup some logic around %hint types
Jun 9, 2022
a8e28cc
dprint: remove chapter-id from %chapter item
Jun 9, 2022
8cb392f
dprint: comment for library
Jun 9, 2022
d0b8d28
hoon: add %dict tag to %spec for doccords
Jun 22, 2022
552b8e9
hoon: spec doccord parsing, refactor +till +tall
Jun 22, 2022
6f66a6d
pprint: add %dict tag
Jun 22, 2022
941ff18
hoon: refactor doccord parsing for +tall and +till
Jun 24, 2022
8f946ed
dojo: print %help hints with ??
Jun 24, 2022
8cd919b
dojo: ?? pattern matches on %hint types
Jun 28, 2022
efe01b8
hoon: batch comment doccords inside of cores
Jun 28, 2022
8f48f08
dprint: change to batch comment syntax
Jun 28, 2022
77b5c73
hoon: fix batch comment parsing for ++ $ arms
Jun 28, 2022
72dec14
dprint: update default core arm comment syntax
Jun 28, 2022
5b65288
dprint: add styled text first run
Jun 30, 2022
4b8cdd6
dprint: easier to read style changes
Jun 30, 2022
69b06e0
dprint: add identifying glyphs to various items
Jun 30, 2022
0f8f90c
dprint: simplify type to item interface
Jun 30, 2022
b4d0444
dprint: add missing doccords
Jun 30, 2022
b3e6f82
dojo: change doccords syntax to be path-like
Jun 30, 2022
97d183b
Merge branch 'master' into jon/doccords
Jun 30, 2022
5710826
dprint: fix test library argument
Jun 30, 2022
37ce546
dprint: simplify arm doc testing
Jul 1, 2022
3bfad48
hoon: fix batch comment parser
Jul 1, 2022
2028ae9
dprint: batch comment tests, more refactoring
Jul 1, 2022
274bc16
dprint: remove erroneous sigpam
Jul 1, 2022
b80590f
hoon: remove _docs-engine
Jul 1, 2022
de19456
hoon: revamp doccords parsing for batch comments
Jul 6, 2022
a4ca510
dprint: fix syntax and test suite for new parser
Jul 6, 2022
1cd95a9
hoon: add +$ cuff (list link)
Jul 6, 2022
27135f1
dprint: links -> cuff
Jul 6, 2022
938dc8c
dojo: reverse doccords query ordering
Jul 6, 2022
37343b6
doccords: add sample library lib/deco.hoon
Jul 6, 2022
948bd1e
doccords: adds batch comment examples to lib/deco
Jul 6, 2022
862f6cc
doccords: update language in lib/deco
Jul 6, 2022
4dd8b4d
doccords: change :: in lib/deco to :>
Jul 6, 2022
b7412d9
doccords: lib/deco remove informal comment
Jul 6, 2022
ef9297c
doccords: these <-> other locations
Jul 6, 2022
73c0222
doccords: deco convention for +$ arms
Jul 6, 2022
c295123
doccords: deco remove double comment
Jul 6, 2022
49420e2
hoon: refactor %brcn %brpt optional arg parsing
Jul 17, 2022
5fc3b3f
hoon, dprint: change doccords syntax to ::
Jul 19, 2022
bd69f09
gen: add todo item to +help for doccords
Aug 10, 2022
f4a84ca
hoon, dprint: remove |% and |@ core names
Nov 15, 2022
c11d11e
deco: revision to account for :: doccords syntax
Nov 15, 2022
618fc0f
Merge branch 'next/arvo' into jon/doccords
Nov 15, 2022
06a7daa
hoon: change %dict spec to %gist
Nov 16, 2022
244d0d2
hoon: change apse:docs to parse as a $note
Nov 18, 2022
64f6430
dprint: +find-item-in-type core name=summary
Nov 21, 2022
1a69393
dprint: arms that build cores return core items
Nov 21, 2022
1fed185
dprint: refactor +find-item-in-type &co
Nov 22, 2022
387ae3e
hoon: remove +vil
Nov 23, 2022
df45bfb
hoon: ~master-morzod comments on doccords
Nov 23, 2022
0fbdd68
dprint: refactor some printing logic
Nov 29, 2022
ec74127
dprint: dont print (undocumented) on arms
Nov 29, 2022
f519b4c
hoon: fix sig rune whitespace to allow doccords
Nov 30, 2022
ca3140a
hoon: doccord parsing fixes
Dec 5, 2022
baa4894
hoon: rune parser whitespace changes for docs
Dec 5, 2022
3c32378
hoon: make some comments into doccords
Dec 5, 2022
2f4b716
dprint: fixes and refactoring of _hunt, signatures
Dec 5, 2022
0ed484a
hoon: +seam and +scye doccords edit
Dec 5, 2022
4afdfdb
hoon: remove unused $links
Dec 5, 2022
ce209fc
hoon: %gist spec doccords are tagged
Dec 5, 2022
3b6f0f5
hoon: remove comment on batch arm docs above chap
Dec 5, 2022
75cf230
hoon: revise doccord intermediate parse structures
Dec 6, 2022
b76134f
hoon: attach all untagged arm docs
Dec 6, 2022
627827f
hoon: revise leap:docs and apse:docs
Dec 6, 2022
fc8449d
dprint: add casting to some _hunt arms
Dec 7, 2022
d508c8c
hoon: add comment about .nut in +ax
Dec 7, 2022
a350b12
dprint: uncomment chapter names in _hunt
Dec 8, 2022
25dba7e
hoon: remove extra hoon casts in +decorate
Dec 14, 2022
68c2ab5
hoon: fix .nut comment
Dec 14, 2022
44aa90c
hoon: remove +hint:ax
Dec 15, 2022
e04262e
hoon: swap ?. for ?: on +loaf and +loan
Dec 15, 2022
835428d
dprint: cut off signatures of length >= 3
Dec 15, 2022
4d08400
dprint: call $ arms $ arms
Dec 15, 2022
d7edbd6
hoon: doccordsify hoon.hoon comments
Dec 16, 2022
d5bf903
Merge branch 'next/arvo' into jon/doccords
Jan 4, 2023
5b99f74
hoon: remove deprecated lustar parser
Jan 4, 2023
0119eef
Merge branch 'next/arvo' into jon/doccords
philipcmonk Jan 12, 2023
cdaae65
dojo: mule calls to doccords
philipcmonk Jan 12, 2023
a7a3790
kelvin: bump to 139
philipcmonk Jan 13, 2023
40451fa
Revert "Revert "Merge pull request #6039 from tadad/da/apt-in""
philipcmonk Jan 13, 2023
0791c45
hoon: put doccords behind parser flag
philipcmonk Jan 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions bin/solid.pill
Git LFS file not shown
45 changes: 40 additions & 5 deletions pkg/arvo/app/dojo.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:: :: ::
/? 309 :: arvo kelvin
/- *sole, lens :: console structures
/+ sole, pprint, ::
/+ sole, pprint, dprint, ::
auto=language-server-complete, ::
easy-print=language-server-easy-print ::
:: :: ::
Expand Down Expand Up @@ -54,6 +54,7 @@
r=@t
==
[%poke p=goal] :: poke app
[%help p=(list term)] :: doccords
[%show p=?(%0 %1 %2 %3 %4 %5)] :: val/type/hoon/xray
[%verb p=term] :: store variable
== ::
Expand Down Expand Up @@ -180,6 +181,18 @@
;~(pfix cen gap (parse-variable sym ;~(pfix gap parse-mark)))
==
==
::
;~ pfix hax
;~ pose
;~ pfix ace
%+ cook
|= a=(list term)
[[%help (flop a)] 0 %ex [%cnts p=~[[%.y p=1]] q=~]]
(most fas sym)
==
(easy [[%help ~[%$]] 0 %ex [%cnts p=~[[%.y p=1]] q=~]])
==
==
::
;~((glue ace) parse-sink parse-source)
(stag [%show %0] parse-source)
Expand Down Expand Up @@ -621,6 +634,9 @@
++ maar ?: =(%noun p.cay) ~
[[%rose [~ " " ~] >p.cay< ~] ~]
--
::
%help
(dy-inspect p.p.mad p.q.cay)
==
::
++ dy-show |=(cay=cage (dy-print cay ~))
Expand Down Expand Up @@ -660,6 +676,20 @@
:- i=""
t=(turn `wain`?~(r.hit ~ (to-wain:format q.u.r.hit)) trip)
==
::
++ dy-inspect
|= [topics=(list term) sut=type]
%+ dy-rash %mor
=+ to-display=(mule |.((find-item-in-type:dprint (flop topics) sut)))
?: ?=(%| -.to-display)
[%tan [%leaf "Could not find help A"] p.to-display]~
?~ p.to-display
[%tan [%leaf "Could not find help B"]~]~
=/ item (mule |.((print-item:dprint u.p.to-display)))
?: ?=(%| -.item)
[%tan [%leaf "Could not find help C"] p.item]~
p.item
::
++ dy-show-type-noun
|= a=type ^- tank
=- >[-]<
Expand All @@ -676,11 +706,16 @@
[%face ^] a(q $(a q.a))
[%cell ^] a(p $(a p.a), q $(a q.a))
[%fork *] a(p (silt (turn ~(tap in p.a) |=(b=type ^$(a b)))))
[%hint *] ?. ?=(%know -.q.p.a) $(a q.a)
?@ p.q.p.a [(cat 3 '#' mark.p.q.p.a)]~
[(rap 3 '#' auth.p.q.p.a (spat type.p.q.p.a) ~)]~
[%hint *] ?+ q.p.a $(a q.a)
[%know *]
?@ p.q.p.a [(cat 3 '#' mark.p.q.p.a)]~
[(rap 3 '#' auth.p.q.p.a (spat type.p.q.p.a) ~)]~
::
[%help *]
[summary.crib.p.q.p.a]~
==
[%core ^] `wain`/core
[%hold *] a(p $(a p.a))
[%hold *] $(a (~(play ut p.a) q.a))
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Playing %holds (i.e. what we're doing here, not sure if there's an accepted term for this) all throughout a type
often just crashes. Is there a better option? I suppose it could just give up after some chosen depth, but that isn't really user friendly. It ought to "just work". Besides limiting by depth, the only other idea I have is Clay or dojo building a cache of doccords. I don't know much about caches though, so that's just spitballing. A cache is outside of the scope, but a depth limit is easy.

It seems wrong to ship a feature that has such a high chance of crashing.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since addressing this sort of issue is one of the main goals of the doccords apprenticeship, my opinion now is that its fine to ship this since its an experimental feature seeking a good interface, and its fine to have pain points in the first attempt at an interface.

==
::
:: XX needs filter
Expand Down
2 changes: 1 addition & 1 deletion pkg/arvo/gen/help.hoon
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
|= a=* ^- [cord path]
[;;(@t a) (welp (slag len pax) /[nam])]
--
::
::TODO: make this work with doccords
:- %say
|= [[now=time @ our=ship ^] typ=$@(~ [p=term ~]) ~]
=/ pax=path /(scot %p our)/base/(scot %da now)/gen :: XX hardcoded
Expand Down
189 changes: 189 additions & 0 deletions pkg/arvo/lib/deco.hoon
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
:: Hoon doccords sample
::
:: this is a sample file designed to explain syntax and conventions
:: for doccords
::
:: all lines must be under 80 characters. no blank lines.
:: any line longer than 60 characters is probably too long.
:: uppercase or non-ascii letters are strongly discouraged.
::
:: whenever possible, use formal decorations. {::} decorates
:: the next expression when put on its own line, and the previous
:: expression if written on the same line
::
:: there are two places to put decorations: in line with the
:: code, and on the right margin.
::
:: the file below is a well-commented library, built around
:: a typical two-core structure. the cores are labeled {%arch}
:: (structures) and {%work} (productions).
::
:: this code is written to display the variety of formatting
:: options the parser allows. a specific convention should pick
:: one of these styles and stick to it.
::
:: there are three ways to mark the beginning of a formal comment:
:: 1- {:: $foo:}
:: 2- {:: +bar:}
:: 3- {:: }
::
:: style 1 may optionally be followed by a series of paragraphs, where each
:: paragraph is preceded by a line containing only {::} and whitespace, and
:: each line of a given paragraph is preceded by four aces.
:: {::}
:: {:: more text}
:: {:: even more text}
:: {::}
:: {:: |=(code=hoon !!)}
::
:: style 2 is much like style 1, but paragraphs are indented by two spaces
:: instead of four.
:: {::}
:: {:: more text}
:: {:: even more text}
:: {::}
:: {:: |=(code=hoon !!)}
::
:: code is indented a total of six aces, for either style.
::
:: style 3 is used to annotate the hoon or spec that immediately follows
:: the comment. paragraphs are written with style 2.
::
:: the $foo and +bar above are examples of *lexical locations* for
:: style and batch-commenting purposes. this tells the parser to attempt
:: to attach the comment to the specified location. these locations
:: may be written as follows:
:: - `|foo` means a chapter
:: - `%foo` means a constant
:: - `.foo` means a face
:: - `+foo` means an arm
:: - `$foo` means a spec
:: - `^foo` means a core
:: - `_foo` means a door
:: - `=foo` means a gate
:: - `/foo` means a file path segment
::
:: thus /lib/foo^widget|initial=open means the =open gate in the |initial
:: chapter of the ^widget core in the /foo library
::
:: at present, doccords does not support lexical locations in full.
:: only single-element locations of the form `$foo` and `+foo` are supported,
:: and must be written above an arm in the core to which they are to be
:: attached, and after the chapter they are in (if the core has chapters).
:: you may still write doccords for other locations in anticipation of the
:: fully supported lexical location, but they will be thrown away before they
:: make it to the compiler.
::
:: a postfix formal comment will either attach to hoon or spec on the
:: current line, or the arm name if there is no hoon or spec on the
:: line. the convention for +$ arms is that the comment attached to the
:: arm is about the mold itself, while the comment attached to the spec
:: is about the output type of the mold.
::
:: to inspect doccords in this file from dojo, try the following:
::
:: > =deco -build-file %/lib/deco/hoon
:: > # deco
:: > # deco/arch
:: > # deco/arch/molds
:: > # deco/arch/molds/goof
::
:: > ?? *goof:deco
::
=> ::
:: structures for our imaginary hello, world generator.
::
:: nothing forces us to put structures in a separate core.
:: but compile-time evaluation doesnt work in the current
:: core; we often want to statically evaluate structures.
::
:: there are three kinds of structures: moldss (normalizing
:: functions), mold builders (functions that build molds), and
:: constants (static data).
::
:: most code will not need its own mold builders. but put them
:: in a separate chapter (separated by {+|}).
|%
:: molds are functions that normalize nouns.
::
:: arms producing molds are introduced with {+$}. the
:: compiler will copy the arm decoration onto its product
+| %molds
:: $jam: some delicious jam
:: $jelly: different from jam?
+$ spot [p=@ q=@] :: a coordinate
+$ tops :: mold for coordinate
[p=@ q=@] :: another coordinate
+$ goof :: a simple tuple mold
$: foo=@ :: something mysterious
bar=@ :: go here for drink
moo=(binary-tree juice) :: cows do this
==
+$ juice :: fruity beverage mold
$% [%plum p=@] :: fresh prune
[%pear p=@ q=@] :: good for cider
[%acai p=@] :: aztec superfood
==
+$ jam @tas
+$ jelly @tas
:: mold builders are functions that build molds from other molds
::
:: other languages might call these "type constructors"
:: or "higher-kinded types".
+| %mold-builders
++ binary-tree :: tree mold builder
|* a=$-(* *)
$@(~ [n=a l=(binary-tree a) r=(binary-tree a)])
::
:: if you have constants, put them in their own chapter.
+| %constant
++ answer :: answer to everything
42
--
:: engines for our imaginary hello, world app.
::
|%
:: +default-jam: bunts $jam
:: +default-juice: bunts $juice
++ say-hello :: say hi to someone
:: friendly welcome message
::
|=
:: .txt: friend to say hi to
::
txt=term
^- tape
"hello, {(rip 3 txt)}"
:: +say-goodbye: say a really proper goodbye
::
:: some paragraphs about the goodbye algorithm, possibly
:: including code indented by four extra spaces:
::
:: ?: =(%hello %world)
:: %hello
:: %world
::
++ say-goodbye
:: describe product of function
::
|=
:: .txt: departing friend
:: .num: number of friends
$: txt=term
num=@
==
^- tape
:: .foo: four
:: .bar: forty-two
=/ foo (add 2 2)
=/ bar (add (mul num foo) 2)
=/ moo (mul num bar) :: for all the cows
"goodbye and {(scow %ud moo)}, {(rip 3 txt)}"
::
++ say-minimum :: minimal decoration
|= txt=term
"nothing to say to {(rip 3 txt)}"
::
++ default-jam *jam
++ default-juice *juice
--