Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Hello: the first program

Area: Getting started Teaches: the shape of an Argon source file — the std::core opt-in, a struct and an enum, a function, a derive rule, and the meta-calculus introducers (metaxis / metatype) that make the language vocabulary-neutral. Prerequisites: none — this is the entry point. Run: ox build examples/hello && ox check examples/hello

Argon ships zero built-in classifying vocabulary. Even type and rel — the keywords you declare a concept and a relation with — are not language keywords; they are the baseline introducers in std::core, brought in by an explicit use:

use std::core::{type, rel};

That single line is the whole story of the language’s neutrality: the words you classify your domain with are imported, never assumed. A foundational ontology like UFO is just another package you use — never something baked into the compiler.

What to read in root.ar

Ordinary data carriers — a struct and an enum. These are the value-level shapes, the parts of Argon that look like any modern typed language:

pub struct Diagnostic { severity: Severity, code: String, message: String }
pub enum Severity { Error, Warning, Info, Hint }

The meta-calculus introducers. A metaxis declares an axis of classification — a user-named dimension the compiler never reads the meaning of, only the lattice. A metatype is an introducer keyword built from positions on those axes:

pub metaxis rigidity for metatype { anti_rigid < semi_rigid < rigid };
pub metaxis sortality for metatype { sortal, non_sortal };

pub metatype kind = { rigidity: rigid, sortality: sortal };

After this, kind is usable as a declaration keyword for concepts — the same mechanism the vocabulary packages in this cluster (vocab_pkg_v0, metarel_vocab_v0) publish for other packages to import. hello declares the axes locally; the rest of the cluster shows them crossing a package boundary.

A function and a derive rule round out the file — the function is a pure value-level definition, the derive is a rule head over a body:

pub fn double(x: Int) -> Int = x * 2;
derive owes_tax(p) :- p.income > 0;

Running it

hello is the parser/elaboration smoke example — it declares forms but seeds no individuals, so there is nothing to query. Build it and check it:

$ ox build examples/hello
wrote examples/hello/target/root.oxbin (11 events, 6204 bytes)

$ ox check examples/hello --codes
ok

The artifact carries 11 events (one per declaration). ox check passes clean.

Honest caveats (what runs today)

  • This package declares no pub query and no scenario, so ox query reports (module declares no \pub query` items). The owes_tax derive returns **0 tuples** (ox derive examples/hello owes_tax) — no Personindividuals are seeded andPersonhere has noincomefield, so the rule has nothing to fire on. The file is a *shape* demonstration, not a reasoning demonstration; for reasoning that produces rows, seeexamples/first_class_relationsandexamples/legal_norms_can_vote`.

This example is compiled and checked through the same ox pipeline the rest of the corpus uses; if a language change breaks its parse or elaboration, the build fails rather than the docs going stale.