Files
AILang/crates/ailang-surface/src/lib.rs
T
Brummel 41804a39fb check: over-strict-mode lint (iter 19a)
When a fn-param is annotated (own T) but the body never consumes
it (consume_count == 0) and never destructures it via match, the
linearity pass now emits a Severity::Warning diagnostic with a
form-A-rendered (borrow T) rewrite as suggested_rewrite. Pure
advisory, Decision 10 unchanged.

First Warning-severity diagnostic the typechecker emits; three
CLI exit paths gated on Error-only.

JOURNAL: design entry + iter 19a shipping entry.
2026-05-08 17:56:58 +02:00

40 lines
1.7 KiB
Rust

//! AILang authoring surface — form (A) S-expression projection.
//!
//! This crate is **one of potentially many** producers / consumers of
//! [`ailang_core::ast::Module`] values. The JSON-AST in `ailang-core`
//! remains the canonical, hashable, content-addressed source of truth;
//! form (A) is the AI-authoring projection optimised for token-efficient
//! production by LLMs (see `docs/DESIGN.md` Decision 6).
//!
//! ## Modules
//!
//! - [`mod@lex`] — hand-written lexer for the 3-rule lexical core
//! (whitespace / parens / comments delimit tokens; first character
//! classifies into integer / string / ident).
//! - [`mod@parse`] — hand-written recursive-descent parser. One Rust
//! function per EBNF production, line-by-line auditable. No
//! parser-combinator dependency.
//! - [`mod@print`] — deterministic pretty-printer that emits form (A).
//! Round-trip with the parser is the contract that gates the
//! surface (see the integration test `tests/round_trip.rs`).
//!
//! ## Round-trip contract
//!
//! For every well-formed [`ailang_core::ast::Module`] value `m`,
//! [`parse()`] applied to [`print()`]`(m)` produces a module whose
//! canonical JSON bytes equal those of `m`. This is enforced by the
//! integration test against every `examples/*.ail.json` fixture.
//!
//! ## Architectural pin
//!
//! No new AST nodes, no schema changes, no new hashable form.
//! `ailang-check` and `ailang-codegen` are projection-agnostic — they
//! consume `Module` values regardless of which front-end produced them.
pub mod lex;
pub mod parse;
pub mod print;
pub use parse::{parse, parse_term, ParseError};
pub use print::{print, term_to_form_a, type_to_form_a};