KotobaDocs

01 The first 42 and the big picture

The first goal is to pass source you can read through a native compiler and obtain 42. Completing this small loop makes the inputs and outputs of later stages easier to understand.

Run the example

00-literal.kotoba contains this complete program:

(ns lesson.literal (:export [main]))
(defn main [] :i64 42)

ns declares the namespace and exported function. main takes no arguments and returns a signed 64-bit integer; :i64 is its result type. Check it with check and execute it with run. The 42 on standard output is the result, not the OS exit code: the successful Mac CLI exits with code 0.

Responsibilities

ComponentResponsibility
KotobaDefines expressions, values, types, effects, and program meaning
AmuReads and checks source, lowers it, generates code, and links projects
KototamaDefines the VM contract for execution inputs, state, outcomes, authority, resources, and receipts
Hosts and providersSupply execution mechanisms and concrete authorized operations, such as file or network access
grantDecides permission; the compiler cannot create new authority
AiueOSThe OS direction for the Kotoba Lisp machine; other hosts need not use that OS

Amu connects Lisp's programs-as-data approach with explicit checking and authority, content-addressed definition identity, multiple targets, and native selfhosting. Wasm is one target, not the definition of the VM.

Relationships
Source→Reading and name resolution
Reading and name resolution→Type and effect checking
Type and effect checking→Lowering to execution IR
Lowering to execution IR→Target artifact
Target artifact→Host execution
Grant and local policy→Host execution
Kototama execution contract⇢Host execution

The boxes describe responsibilities, not one data structure shared by every target or proof of complete VM support. The public Mac CLI is a bounded, single-source entry for main [] :i64, so the initial examples stay within that scope.

Read the source

Read the Amu README and native public entry. Focus on inputs, results, and the distinction between host and guest authority rather than trying to read the entire compiler at once.

Exercise and answer

Change 42 to 43 in a copy and check and run it. The expected result is 43. This observes a source change affecting a result; it does not observe a DefCID change or establish which optimizations ran. Later chapters examine those separately.

Contents · Next: source and forms