Skip to main content

axon_frontend/
lib.rs

1//! AXON compiler frontend.
2//!
3//! Pure frontend of the AXON language: lexer, parser, AST, epistemic
4//! type primitives, type checker, IR generator, and the top-level
5//! compile-time checker that glues them together.
6//!
7//! # Design contract
8//!
9//! This crate has **zero runtime dependencies**. The only allowed
10//! external dep is `serde` (plus its proc-macro chain). Any addition
11//! of a runtime dep (tokio, axum, sqlx, reqwest, aws-*, jsonwebtoken,
12//! …) is rejected at CI time.
13//!
14//! # Consumers
15//!
16//! - `axon` crate (the AXON runtime in `../axon-rs/`) re-exports these
17//!   modules so existing callers keep working.
18//! - `axon-lsp` (Language Server, separate repo) consumes the frontend
19//!   directly without dragging runtime deps.
20//!
21//! # Byte-identical parity
22//!
23//! Outputs must match the Python reference implementation
24//! (`../axon/`) on the golden-file test corpus. Divergences are
25//! release blockers.
26
27pub mod ast;
28pub mod checker;
29pub mod cron;
30pub mod epistemic;
31pub mod ir_generator;
32pub mod ir_nodes;
33pub mod lexer;
34pub mod parser;
35pub mod smart_suggest;
36pub mod store_column_proof;
37pub mod store_introspect;
38pub mod store_schema;
39pub mod store_schema_manifest;
40pub mod tokens;
41pub mod type_checker;
42
43// §Fase 11.a — compile-time catalogs used by the type checker.
44// `refinement` declares the closed Trust<T> catalog; `stream_effect`
45// declares the closed backpressure policy catalog. Both are pure
46// enum-like definitions with `std::fmt` only — no runtime deps.
47// The matching runtime implementations (`trust_verifiers`,
48// `stream_runtime`) live in the `axon` runtime crate.
49pub mod refinement;
50pub mod stream_effect;
51
52// §Fase 11.c — closed catalogue of regulatory authorisations
53// (GDPR/CCPA/SOX/HIPAA/GLBA/PCI-DSS) used by the type checker to
54// enforce `@legal_basis` annotations. Pure catalog, no runtime deps.
55pub mod legal_basis;
56
57// §Fase 11.e — OTS (Ontological Tool Synthesis) compile-time slug
58// catalogs. Runtime pipeline execution lives in `axon::ots` and
59// re-exports these for backward compatibility.
60pub mod ots_catalog;
61
62// §Fase 13.g — LSP-facing analysis primitives for typed channels.
63// Pure AST helpers consumed by `axon-lsp` (sibling repo) to implement
64// hover, completion, go-to-definition and find-references. Zero
65// runtime deps — stays inside the Fase 12.c contract.
66pub mod channel_analysis;
67
68// §Fase 41.a — session types: the pure algebra of typed bidirectional
69// dialogue (WebSocket as a cognitive primitive). The session-type
70// grammar + the duality involution `(·)⊥` + regular-coinductive
71// equality for `μ`-types + the connection law (`peer ≡ self⊥`).
72// Grounded in Caires–Pfenning (session types = intuitionistic linear
73// propositions). Pure — no runtime deps; the `socket` surface (41.b),
74// credit-refined backpressure (41.c) and the typed-WS runtime (41.d,
75// in the `axon` crate) build on this. See
76// docs/paper_websocket_cognitive_primitive.md.
77pub mod session;
78// §Fase 41.h — multiparty session types (Honda–Yoshida–Carbone). A
79// `GlobalType` declares an n-party protocol; projection `G⌐r` extracts
80// each role's binary `SessionType` (the §41.a algebra). The safe-
81// realizability gate is `project_all`: a `Result::Ok` is the structural
82// certificate that independent per-role runtimes faithfully realise `G`.
83pub mod multiparty;
84
85// §Fase 6.a — the closed registry of every primitive AXON exposes as
86// a named language construct. Single source of truth for the ℰMCP
87// coverage gate + scaffold CLI + future LSP completions / docs-site
88// generators. Pure const data, no runtime deps. See the module-level
89// docs for the discipline (registry + corpus = atomic addition).
90pub mod primitive_registry;
91pub use primitive_registry::{
92    by_category, coverage_summary, find as find_primitive, with_status, CoverageSummary,
93    DocStatus, PrimitiveInfo, PRIMITIVE_REGISTRY,
94};