#dsl #ir #deterministic #compiler #dsl-compiler

no-std rustd_core

Core types and IR for the RustD deterministic DSL

3 unstable releases

0.2.0 Jan 23, 2026
0.1.1 Jan 23, 2026
0.1.0 Jan 23, 2026

#9 in #dsl-compiler


Used in 6 crates

Apache-2.0

185KB
4K SLoC

RustD

A Deterministic DSL Built on Four Axioms

RustD is a deterministic domain-specific language (DSL) implemented in Rust, designed for building provably correct, reproducible systems. Built from the ground up on four fundamental axioms, RustD eliminates non-determinism at the language level, making it ideal for safety-critical applications, distributed systems, and scenarios requiring perfect reproducibility.

Core Philosophy

RustD is built on four fundamental axioms that ensure deterministic behavior:

  1. Purity - All computations are pure functions with no side effects
  2. Immutability - Data structures are immutable by default
  3. Explicit Time - Temporal ordering is explicit and traceable
  4. Reproducibility - Identical inputs always produce identical outputs

These axioms eliminate entire classes of bugs and make RustD programs inherently:

  • Auditable - Every computation can be traced and verified
  • Reproducible - Results are guaranteed to be consistent across runs
  • Parallelizable - Pure functions can be safely executed in any order
  • Testable - No hidden state means complete test coverage is achievable

Features

Compiler & Runtime

  • Deterministic Compiler - Compiles RustD DSL to optimized bytecode
  • CPU Runtime - Fast interpreted execution with zero non-determinism
  • Type System - Strong static typing with inference
  • Module System - Clean module organization with explicit dependencies

Developer Tools

  • CLI Tools - Comprehensive command-line interface for compilation and execution
  • FFI Support - Rust bindings for seamless integration
  • Cryptographic Verification - Blake3-based audit trails for compliance

Code Quality

  • Zero Non-Determinism - Language-level guarantees
  • Contract-Based Development - Formal contracts between modules
  • Reproducible Testing - Identical results across test runs

Architecture

rustd/
├── rustd_core/           # Core types and intermediate representation
├── rustd_compiler/       # Deterministic compiler implementation
├── rustd_runtime/        # CPU interpreter runtime
├── rustd_cli/            # Command-line interface
├── rust_bindings/        # FFI bindings for Rust integration
├── examples/
│   └── clinical_nlp/     # Clinical text processing demo
└── experimental/         # Advanced features (GPU, LSP, LLVM, etc.)

Use Cases

Safety-Critical Systems

RustD's deterministic nature makes it perfect for:

  • Medical device software
  • Aerospace and defense systems
  • Financial trading systems
  • Industrial control systems

AI & Machine Learning

  • Reproducible ML Pipelines - Ensure identical results across training runs
  • Clinical NLP - Deterministic text analysis for medical applications
  • Data Processing - Consistent transformation of sensitive data

Distributed Systems

  • Consensus Protocols - Eliminate timing-based race conditions
  • Event Sourcing - Replay events with perfect consistency
  • Audit Trails - Cryptographically verifiable computation logs

Getting Started

Prerequisites

  • Rust 1.70 or higher

Building

# Clone the repository
git clone https://github.com/latentcollapse/RustD.git
cd RustD

# Build all components
cargo build --release

# Run tests
cargo test

# Install the CLI
cargo install --path rustd_cli

Quick Example

// RustD code is deterministic by design
fn process_data(input: Data) -> Result {
    let normalized = normalize(input);
    let transformed = transform(normalized);
    let validated = validate(transformed);
    finalize(validated)
}

Every execution of this function with the same input will produce identical results, guaranteed.

Clinical NLP Demo

See a real-world example of deterministic processing in action:

# Run the clinical text processing demo
cargo run -p clinical_nlp_demo --bin deterministic_processing

This demo shows:

  • Deterministic tokenization and entity extraction from clinical notes
  • Cryptographic audit trails for compliance
  • 100% reproducible results across runs
  • See examples/clinical_nlp/ for details

Why RustD?

Determinism by Default - Unlike traditional languages where you must carefully avoid non-determinism, RustD makes it impossible to introduce non-deterministic behavior.

Production Ready - RustD isn't just a research project. It's a fully-featured DSL with:

  • Complete compiler toolchain
  • Multiple runtime backends
  • IDE integration via LSP
  • Comprehensive testing infrastructure

Built in Rust - Leveraging Rust's safety guarantees and ecosystem while adding deterministic execution guarantees on top.

Roadmap

v1.0 (Current - Production Ready)

  • Core deterministic compiler
  • CPU interpreter runtime
  • FFI bindings for Rust
  • Clinical NLP example with audit trails
  • Comprehensive test suite

Future (See experimental/)

  • GPU acceleration (Vulkan backend - functional, needs integration)
  • Native code generation (LLVM backend - functional, needs polish)
  • Full LSP server (30+ modules implemented, needs testing)
  • Formal verification framework
  • Network primitives with deterministic timing

Contributing

RustD is under active development. We welcome contributions! Please see CONTRIBUTING.md for guidelines.

License

Licensed under the Apache License, Version 2.0. See LICENSE for details.

Contact

For questions, feature requests, or collaboration opportunities, please open an issue on GitHub.


Built with determinism. Powered by Rust.


lib.rs:

HLX Core

Core types and IR for the HLX deterministic ML substrate.

This crate defines:

  • Value: The 7 fundamental types + Contract
  • Instruction: The IR for computation
  • Capsule: Integrity-wrapped instruction sequences
  • LC-B encoding/decoding

Axioms

  • A1 (Determinism): Same input → same LC-B output
  • A2 (Reversibility): decode(encode(v)) == v
  • A3 (Bijection): 1:1 correspondence between values and encodings
  • A4 (Universal Value): All types lower to this core

Dependencies

~4–6MB
~127K SLoC