7A `twig` is an AST node: the noun that the Hoon compiler makes
8when it parses a source expression.
10The definition of `twig` is the definition of Hoon. So let's
11define the syntax and semantics of Hoon, a twig at a time. But
12first, basic twig anatomy.
14## Twig anatomy and jargon
16A twig is a tagged union (`book`) with the form `{stem bulb}`,
17where the `stem` is an atomic symbol. The bulb for each stem has
18its own type, which varies by stem. (Compare with Lisp, where
19every AST node is a tag and a list of child nodes.)
21There are no user-level macros. All stems are built into Hoon.
22Most stems are implemented as internal macros, however.
24The bulb is usually a tuple, sometimes a list or map. An element
25of this structure is a *subexpression*.
27Usually a subexpression is itself a `twig`; sometimes it's an
28`@tas` (symbol) or a `wing` (reference path).
32Solely for clarity, we use the type alias `moss` for twigs whose
33product is used as a mold. A `moss` is just a twig, both in
34syntax and semantics; again, the difference is how we use it.
36Twigs are described as *mossy* and *woody*; an example of X is
37the woody form of X, a mpld producing X is its woody form. For
38instance, `$foo` (mossy) is a mold whose product is always `%foo`
39(woody). (Obviously, wood is *yang* and moss is *yin*, so we
40can also say "yang foo" or "yin foo".)
44Fortunately, the twigs fit neatly into clear categories which
45match their rune prefix. Read forward by category:
51The full Core Hoon `twig`. Note that this is simplified, but
52everything useful can still be done in Core.
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list