0x0LearnReferenceLibrariesMigration0x0.jmp0x1b.com

First Program

Current implementation evidence: examples/main.0x0, README.html, and

docs/language.html.

Source File Shape

A 0x0 source file is a sequence of parenthesized forms. The conventional first

form declares the module:


(⊙ main)

The smallest executable example in this repository is:


;;; Minimal executable module. Expected output: 42.

(⊙ main)

(ƒ main
  (∷ (→ Unit I64))
  (_)
  42)

The ;;; comment documents file intent. The compiler ignores comments, but the

documentation policy expects each source file to explain its purpose and

observable result.

Main Function

The executable entry point is a function named main.


(ƒ main
  (∷ (→ Unit I64))
  (_)
  42)

The current function shape is:


(ƒ name
  optional-annotations...
  (param...)
  body...)

The final body expression is the function result. In this example, main

returns 42.

Run It

After the seed or trusted compiler path has produced bin/zero, run:


./bin/zero run examples/main.0x0

Expected output:


42

First Rule

If a public example is shown as executable, it must point to a real .0x0

source file or clearly say it is illustrative.