This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Run all tests
cargo test --all --all-targets
# Run a single test
cargo test <test_name>
# Run tests in a specific module
cargo test type_system::tests::subtypingdada-model is a formal model for the Dada programming language, implemented using formality-core from a-mir-formality. It defines the type system and type checking rules for Dada's permission-based ownership model.
-
src/grammar.rs: Defines the AST/grammar using formality-core's#[term]macro. Contains:Program,ClassDecl,MethodDecl- program structureTy,Perm- types and permissionsExpr,Statement,Place- expressions and control flowPredicate- type predicates for constraints
-
src/type_system.rs: Entry point for type checking. Orchestrates checking of programs and declarations. -
src/type_system/env.rs: TheEnvstruct tracks typing context including:- Program reference, universe for universal variables
- Local variable types, predicate assumptions
- Methods for managing scope and variable bindings
Permissions: Dada uses a permission system instead of Rust's borrow checker:
given- owned, unique (like Rust's ownership)shared- owned, shared (likeRc)ref[places]- borrowed referencemut[places]- borrowed mutable referencemoved[places]- moved permission
Class Predicates (in order):
guard class- affine types with destructorsclass(default) - mutable fields, can be shared with.sharestruct(shared class) - value types, always shared/copyable
Judgment Functions: The type system uses formality-core's judgment_fn! macro to define inference rules. See src/type_system/subtypes.rs for subtyping rules.
Tests are in src/type_system/tests/ as Rust unit tests using expect_test for snapshot testing. Tests use the term() macro to parse Dada code strings and check_program() to type-check them.
WIP.md at the project root tracks the current implementation plan. Update it as you complete tasks or discover new work items. When resuming from a checkpoint, read WIP.md to pick up where you left off.
The book/ directory contains mdBook documentation explaining the type system design. Build with mdbook build book/.