Prism is an AI-first programming language designed with semantic types, capability-based security, and maximum extensibility. Built for the era where AI and humans collaborate on code, Prism provides unprecedented expressiveness for business logic while maintaining safety and performance.
- Semantic Type System: Types that express business meaning, not just memory layout
- AI-First Design: Every language construct generates structured, AI-legible metadata for external AI tools
- Capability-Based Security: Zero-trust execution with fine-grained permission control
- Smart Module System: Code organization that follows human mental models
- Effect System: Precise tracking of computational effects and resource usage
- Multi-Target Compilation: Native (LLVM), TypeScript, and WebAssembly backends
This project follows a modular workspace architecture with maximum extensibility:
prism/
βββ Cargo.toml # Workspace configuration
βββ crates/
β βββ prism-common/ # Shared utilities and types
β βββ prism-ast/ # Abstract Syntax Tree definitions
β βββ prism-lexer/ # Tokenization and lexical analysis
β βββ prism-parser/ # Parsing with error recovery
β βββ prism-semantic/ # Type checking and semantic analysis
β βββ prism-effects/ # Effect system and capabilities
β βββ prism-codegen/ # Code generation backends
β βββ prism-ai/ # AI metadata export and context extraction
β βββ prism-cli/ # Command-line interface
β βββ prism-runtime/ # Runtime support libraries
βββ design-docs/ # Language design specifications
βββ PLD-001.md # Semantic Type System
βββ PLD-002.md # Smart Module System
βββ PLD-003.md # Effect System & Capabilities
βββ PLT-001.md # AST Design & Parser Architecture
# Pull and run the Prism compiler
docker run --rm -v $(pwd):/workspace ghcr.io/griffincancode/prism/prism-compiler:latest --help
# Start a development environment
docker run --rm -it -v $(pwd):/workspace ghcr.io/griffincancode/prism/prism-dev:latest
# Or use Docker Compose for full development setup
git clone https://github.com/GriffinCanCode/prism.git
cd prism
docker-compose up prism-dev
- Rust 1.75.0 or later
- Git
- Docker (optional, for containerized development)
git clone https://github.com/GriffinCanCode/prism.git
cd prism
cargo build --release
# Build Docker images (optional)
./scripts/build-images.sh
@capability "User Management"
@description "Handles user authentication and profile management"
module UserManagement {
section types {
type Email = String where {
pattern: r"^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$",
max_length: 254,
validated: true
};
type User = {
id: UserId,
email: Email,
created_at: Timestamp,
last_login: Option<Timestamp>
} where {
invariant: email.is_valid(),
@aiContext: "Represents a user in the system with validation"
};
}
section interface {
function authenticate(email: Email, password: String)
-> Result<User, AuthError>
effects [Database.Query, Cryptography.Hash]
requires email.is_valid()
ensures |result| match result {
Ok(user) => user.email == email,
Err(_) => true
} {
// Implementation here
}
}
}
Prism provides multiple Docker images for different use cases:
ghcr.io/griffincancode/prism/prism-compiler
: Optimized compiler for production buildsghcr.io/griffincancode/prism/prism-dev
: Full development environment with toolsghcr.io/griffincancode/prism/prism-lsp
: Language server for IDE integrationghcr.io/griffincancode/prism/prism-ci
: CI/CD optimized environment
# Compile a Prism project
docker run --rm -v $(pwd):/workspace ghcr.io/griffincancode/prism/prism-compiler:latest compile src/
# Interactive development
docker run --rm -it -v $(pwd):/workspace ghcr.io/griffincancode/prism/prism-dev:latest
# Language server for IDE
docker run -d -p 9257:9257 ghcr.io/griffincancode/prism/prism-lsp:latest
# CI/CD pipeline
docker run --rm -v $(pwd):/ci ghcr.io/griffincancode/prism/prism-ci:latest test --all
# Start full development environment
docker-compose up prism-dev
# Run specific services
docker-compose up prism-lsp prism-docs
# Clean rebuild
docker-compose build --no-cache
Prism includes helpful scripts for building and testing:
# Build all Docker images
./scripts/build-images.sh
# Verify your installation
./scripts/verify-installation.sh
# See all available scripts
ls scripts/ && cat scripts/README.md
Prism's design is documented in a series of technical specifications:
- PLD-001: Semantic Type System - Types that carry business meaning
- PLD-002: Smart Module System - Code organization by capabilities
- PLD-003: Effect System & Capabilities - Security and resource control
- PLT-001: AST Design & Parser Architecture - Implementation details
# Build all crates
cargo build
# Build with optimizations
cargo build --release
# Build specific crate
cargo build -p prism-ast
# Run all tests
cargo test
# Run tests for specific crate
cargo test -p prism-parser
# Run benchmarks
cargo bench
# Check formatting
cargo fmt --check
# Run clippy
cargo clippy -- -D warnings
# Fix formatting
cargo fmt
Every language feature is designed with AI comprehension as a primary consideration. Code should be as readable to AI systems as it is to humans.
Types express what data means, not just how it's stored. Business rules are encoded in the type system for compile-time verification.
Capability-based security ensures code can only access the resources it explicitly needs. Supply chain attacks are prevented through dependency isolation.
Start simple and add complexity only when needed. The language scales from prototypes to enterprise systems.
Code organization follows human mental models rather than arbitrary technical boundaries.
Prism includes first-class AI metadata export features:
- Semantic Context Extraction: AI systems can understand code intent through rich type metadata
- AI-Readable Documentation: Built-in annotations provide context for AI code analysis
- Prompt Injection Prevention: Secure handling of AI-generated code and prompts
- Structured Metadata Export: Rich semantic information exported for external AI and development tools
// Dependencies can only access explicitly granted capabilities
dependency analytics: AnalyticsLib with capabilities {
network: Network.attenuate({
allowed_hosts: ["analytics.company.com"],
protocols: [HTTPS],
rate_limit: 10.per_minute
})
// No file system or database access
}
function process_payment(amount: Money<USD>) -> Result<Receipt, Error>
effects [Database.Transaction, Network.Send, Cryptography.Sign] {
// Compiler ensures all effects are handled safely
}
type Money<Currency> = Decimal where {
precision: 2,
currency: Currency,
non_negative: true
};
type AccountId = UUID tagged "Account" where {
format: "ACC-{8}-{4}-{4}-{4}-{12}",
checksum: luhn_algorithm
};
@capability "Payment Processing"
module PaymentProcessor {
section config {
const MAX_AMOUNT = 10000.00.USD;
const RETRY_ATTEMPTS = 3;
}
section interface {
function charge(card: CreditCard, amount: Money<USD>)
-> Result<Transaction, PaymentError>;
}
}
We welcome contributions! Please see our Contributing Guide for details.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests
- Run the test suite
- Submit a pull request
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT License (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Prism - Programming for the AI age. Built by humans, designed for collaboration.