5c: Compiler Backend & Prettyprinter
+ut
Hoon compiler backend.
Source
This core is too large to include here, refer to hoon.hoon for the source.
+us
Pretty-printer backend.
Source
This core is too large to include here, refer to hoon.hoon for the source.
+cain
Tank pretty-print.
Pretty-print a $vase as a $tank using +deal. This is the same as +sell.
Accepts
A $vase.
Produces
A $tank.
Source
Examples
+noah
Tape pretty-print.
Pretty-print a $vase as a $tape. This is the same as +text.
Accepts
A $vase.
Produces
A $tape.
Source
Examples
+onan
Vise to vase.
Convert a $vise (old $vase) to the new $vase. This is the same as +seer.
Accepts
A $vise.
Produces
A $vase.
Source
Examples
+levi
Type nests or crash.
Check if type .b nests under type .a. Produces %.y if it nests and crashes if it does not.
Accepts
.a is a $type.
.b is a $type.
Produces
A $flag.
Source
Examples
+text
Tape pretty-print.
Pretty print vase .x as a $tape.
Accepts
.x is a $vase.
Produces
A $tape.
Source
Examples
+seem
Promote typo.
Convert $typo (old type) to the new $type.
Accepts
.y is a $typo.
Produces
A $type.
Source
Examples
+seer
Promote vise.
Convert a $vise (old $vase) to the new $vase.
Accepts
.x is a $vise.
Produces
A $vase.
Source
Examples
+sell
Pretty-print vase to a tank.
Pretty-print vase .x to a $tank using +deal:us.
Accepts
.x is a $vase.
Produces
A $tank.
Source
Examples
+skol
Pretty-print type to tank.
Pretty-print type .p to a $tank using +duck:ut.
Accepts
.p is a $type.
Produces
A $tank.
Source
Examples
+slam
Slam a gate.
Slam gat, a gate in a $vase, with sam, a sample in a $vase. Produces a $vase containing the result.
Accepts
.t is a gate in a $vase.
.m is a $noun in a $vase.
Produces
A $vase.
Source
Examples
+slab
Test if contains.
States whether you can access named wing .g in type .p using access method .way.
Accepts
.y is a ?(%read %rite %both) (A $vial without %free). This represents the access method (read, write, or both read and write).
.g is a @tas, the name of a wing.
.p is a $type.
Produces
A $flag.
Source
+slap
Untyped vase .*.
Compile hoon .n with subject .x using .*, producing a $vase of the result.
Accepts
.x is a $noun in a $vase, and is the subject.
.n is some $hoon.
Produces
A $vase.
Source
Examples
+slub
Memoized +slap.
Compiles hoon .gen with subject .vax, producing a $vase of the result, and caches the compilation.
Accepts
.vax is a $noun in a $vase, and is the subject.
.gen is some $hoon.
Produces
A $vase.
Source
Examples
Discussion
+slub produces the same result as +slap, but wraps the +mint call in a ~> %memo./hoon/mint hint. The runtime therefore caches the compilation keyed on /hoon/mint, so repeating the same compile is cheap.
Note that this cache is a side effect with process lifetime: it is held by the runtime, not by the caller, and is not reflected in the product. +slub is worth preferring over +slap where the same expression is compiled repeatedly in a hot path. The cache can be dropped with the %drop runtime hint or by a |meld with =ford &.
+slog
Deify printf.
Prints stack trace .a if the stack trace isn't null, then produces the other input. +slog first takes .a, producing a gate. The gate then takes some hoon.
Accepts
.a is a $tang, and is the sample of +slog.
(slog a) takes some $hoon.
Produces
The result of the hoon given to (slog a), with .a printed to the terminal.
Source
Examples
Discussion
+slog is intended to be put in the middle of a bunch of chained function calls that string a piece of data through them, so that an error message will be printed if there's one to print.
+mean
Crash and printf.
Ends the program and prints .a, a tracing error message.
Accepts
.a is a $tang.
Produces
A crash, with .a printed to the terminal.
Source
Examples
+road
Evaluate trap.
Evaluate a +trap, producing the result if successful or else crashing with a trace.
Accepts
A +trap.
Produces
A $noun.
Source
Examples
+slew
Get axis in vase.
Get axis .e in vase .vax, producing the resulting $vase in a +unit which is null if the axis cannot be retrieved.
Accepts
.e is an $atom.
.x is a $vase.
Produces
A (unit vase).
Source
Examples
+slim
Identical to +seer.
Convert a $vise (old $vase) to a $vase. Identical to +seer.
Accepts
.d is a $vise.
Produces
A $vase.
Source
Examples
+slit
Type of slam.
The $type produced if a gate of type .t were slammed with a sample of type .sam.
Accepts
.t is a $type.
.m is a $type.
Produces
A $type.
Source
Examples
+slob
Superficial arm.
Source
+sloe
Get arms in core.
Produces a list of the arms in a core of type .typ.
Accepts
.p is a type.
Produces
A (list term).
Source
Examples
+slop
Cons two vases.
Produce the vase of a cell of vases .d and .tal.
Accepts
.d is a $vase.
.l is a $vase.
Produces
A $vase.
Source
Examples
+slot
Got axis in vase.
Get axis .e in vase .vax, returning it in a $vase. Crashes if the axis cannot be retrieved.
Accepts
.e is an $atom.
.x is a $vase.
Produces
A $vase.
Source
Examples
+slym
Slam without sample-type.
Slam .gat, a gate in a $vase, with .sam, a $noun. The type of .m is ignored and the type of the resulting vase is determined by the gate alone.
Accepts
.t is a $vase.
.m is a $noun.
Produces
A $vase.
Source
Examples
+sped
Reconstruct type.
Source
+swat
Deferred +slap.
This is the same as +slap except .p is the subject $vase encapsulated in a +trap, and a (trap vase) is produced.
Accepts
.p is a (trap vase).
.n is $hoon.
Produces
A (trap vase).
Source
Examples
Last updated