on f3ca521 help sign in
44 lines 1.8 kB history raw
1+++
2title = "C Runtime System"
3weight = 1
4template = "doc.html"
5aliases = ["docs/about/runtime/", "/docs/learn/vere/runtime"]
6+++
8The Urbit interpreter is built on a Nock runtime system written
9in C, `u3`. This section is a relatively complete description.
11You should keep reading if (a) you're planning to work on the
12Urbit interpreter; (b) you're a language implementation geek; or
13(c) you don't really understand anything until you've seen the
14actual structs.
16## u3: Noun processing in C
18`u3` is the C library that makes Urbit work. If it wasn't called
19`u3`, it might be called `libnoun` - it's a library for making
20and storing nouns.
22What's a noun? A noun is either a cell or an atom. A cell is an
23ordered pair of any two nouns. An atom is an unsigned integer of
24any size.
26To the C programmer, this is not a terribly complicated data
27structure, so why do you need a library for it?
29One: nouns have a well-defined computation kernel, Nock, whose
30spec fits on a page and gzips to 340 bytes. But the only
31arithmetic operation in Nock is increment. So it's nontrivial
32to compute both efficiently and correctly.
34Two: `u3` is designed to be a "solid-state interpreter," ie, a
35single-level store which is transparently snapshotted. This
36implies a specialized memory-management model, etc, etc.
38(Does `u3` depend on the higher levels of Urbit, Arvo and Hoon?
39Yes and no. `u3` expects you to load something shaped like an
40Arvo kernel, and use it as an event-processing function. But you
41don't need to use this feature if you don't want, and your kernel
42doesn't have to be Arvo proper - just Arvo-compatible. Think of
43`u3` as the BIOS and Arvo as the boot kernel. And there are no
44dependencies at all between Hoon the language and `u3`.)