--- sort: 6 next: true title: Expressions --- # Expressions A Hoon expression is called a `twig`. A `twig` is an AST node: the noun that the Hoon compiler makes when it parses a source expression. The definition of `twig` is the definition of Hoon. So let's define the syntax and semantics of Hoon, a twig at a time. But first, basic twig anatomy. ## Twig anatomy and jargon A twig is a tagged union (`book`) with the form `{stem bulb}`, where the `stem` is an atomic symbol. The bulb for each stem has its own type, which varies by stem. (Compare with Lisp, where every AST node is a tag and a list of child nodes.) There are no user-level macros. All stems are built into Hoon. Most stems are implemented as internal macros, however. The bulb is usually a tuple, sometimes a list or map. An element of this structure is a *subexpression*. Usually a subexpression is itself a `twig`; sometimes it's an `@tas` (symbol) or a `wing` (reference path). ## Moss versus seed Solely for clarity, we use the type alias `moss` for twigs whose product is used as a mold. A `moss` is just a twig, both in syntax and semantics; again, the difference is how we use it. Twigs are described as *mossy* (or *moldy*) and *seedy*; an example of X is the seedy form of X, a mold producing X is its mossy form. For instance, `[%foo %bar]` is seedy: a twig producing the noun `[7.303.014 7.496.034]`. `{$foo $bar}` is mossy: a twig producing a function whose product is always `[7.303.014 7.496.034]`. ## Twig categories Fortunately, the twigs fit neatly into clear categories which match their rune prefix. Read forward by category: