0x0LearnReferenceLibrariesMigration0x0.jmp0x1b.com

0x0 Syntax Reference

This reference summarizes implemented 0x0 syntax. See docs/grammar.ebnf for

the compact grammar sketch and docs/language.html for the implementation guide.

Files

A file contains parenthesized forms. The conventional first form is the module:


(⊙ main)

Comments begin with ; and continue to the end of the line.

Imports And Exports

Import a file:


(↥ "helper.0x0")

Import with an alias:


(↥ "helper.0x0" helper)

Import through the package lockfile:


(↥ "pkg:core-map")

Export selected functions from an imported module:


(↦ public-add public-sub)

Functions


(ƒ add
  (∷ (→ I64 I64 I64))
  (cap pure)
  (doc "Return the sum of two integers.")
  (a b)
  (+ a b))

Function annotations are optional, but public library functions should carry

type, capability, and doc annotations where practical.

Bindings And Sequencing

Local bindings:


(≔ ((left 20)
    (right 22))
  (+ left right))

Sequencing:


(do
  (print "ready")
  42)

Conditionals


(if condition then-expression else-expression)

Values

Current values include:

Builtin Areas

The current builtin areas include arithmetic, comparison, lists, text, file,

stdin/stdout, argv/env, and runtime-support helpers documented in

docs/language.html.

Current Limits

language builtins.