A modern, statically-typed programming language with focus on safety, performance, and developer experience.
Veil compiles to efficient C code while providing modern language features like type inference, pattern matching, generics, and async/await.
- 🚀 Fast compilation to optimized C code
- 🛡️ Memory safety without garbage collection
- 🔧 Type inference and strong static typing
- 🎯 Pattern matching and algebraic data types
- ⚡ Async/await support for concurrent programming
- 📦 Built-in package management (coming soon)
- 🔄 Self-updating toolchain via GitHub releases
Unix (Linux/macOS):
curl -sSf https://raw.githubusercontent.com/veil-lang/veil/main/scripts/install.sh | bashWindows (PowerShell):
iex (iwr -useb https://raw.githubusercontent.com/veil-lang/veil/main/scripts/install.ps1).ContentRequirements:
- Rust 1.70+
- Clang 17+ (Unix) / Visual Studio Build Tools (Windows)
- Git
git clone https://github.com/veil-lang/veil
cd veil
cargo install --path crates/cli --forceve --version
# veil-cli 0.2.0-beta.4import std/io;
fn main() {
print("Hello, World!");
}
# Save as hello.veil and run:
ve hello.veilve init my_project
cd my_project
ve runThe ve toolchain provides everything you need for Veil development:
# Compile and run (one command)
ve program.veil
# Build only (generate executable)
ve build program.veil -o my_program
# Build with optimizations
ve build program.veil --optimize
# Generate C code only (no compilation)
ve build program.veil --no-cc# Initialize new project
ve init my_project
# Run project from current directory
ve run
# Run with verbose output
ve run --verbose# Run all tests in a file
ve test tests.veil
# Run specific test
ve test tests.veil --test-name my_test
# List available tests
ve test tests.veil --list# Benchmark a program
ve benchmark program.veil --iterations 10
# Benchmark with detailed output
ve benchmark program.veil --iterations 5 --verbose# Update ve toolchain to latest version
ve update
# Update from nightly channel
ve update --channel canary
# Force update (reinstall current version)
ve update --force
# Package management (coming soon)
ve upgrade# Show compiler internals
ve build program.veil --verbose --dump-norm-hir --pass-timings
# Target specific platform
ve build program.veil --target-triple x86_64-unknown-linux-gnu
# Show cache statistics
ve build program.veil --cache-statsfn main() {
const name = "Alice"; /# String inference
const age: i32 = 30; /# Explicit type
const score: u32 = 100; /# Immutable constant
/# score = score + 10; /# Cannot modify constants
var height = 5.6; /# Mutable f64 inference
height = height + 0.1; /# Can modify mutable variables
print(`Hello, {name}! Age: {age}, Height: {height}`);
}
fn add<T>(a: T, b: T) -> T where T: Add {
a + b
}
fn main() {
const result = add(5, 3); /# i32
const sum = add(2.5, 1.5); /# f64
print(`Results: {result}, {sum}`);
}
struct User {
name: str,
age: u32,
email: str,
}
enum Shape {
Circle(f64),
Rectangle(f64, f64),
Triangle(f64, f64, f64),
}
fn area(shape: Shape) -> f64 {
match shape {
Shape.Circle(radius) => 3.14159 * radius * radius,
Shape.Rectangle(width, height) => width * height,
Shape.Triangle(a, b, c) => {
const s = (a + b + c) / 2.0;
(s * (s - a) * (s - b) * (s - c)).sqrt()
}
}
}
fn main() {
const user = User {
name: "Alice",
age: 30,
email: "alice@example.com",
};
var circle = Shape.Circle(5.0);
print(`Circle area: {area(circle)}`);
/# Can reassign mutable variables
circle = Shape.Rectangle(10.0, 20.0);
print(`Rectangle area: {area(circle)}`);
}
import std::net;
async fn fetch_data(url: &str) -> Result<str, Error> {
const response = await http::get(url)?;
await response.text()
}
async fn main() {
const data = await fetch_data("https://api.example.com/data");
match data {
Ok(content) => print(`Data: {content}`),
Err(e) => print(`Error: {e}`),
}
}
Veil uses a modular compilation pipeline:
- Parser - Pest-based grammar with error recovery
- AST - Type-safe abstract syntax tree
- HIR - High-level IR with type information
- Resolution - Symbol resolution and scope analysis
- Type Checker - Type inference and checking
- Normalization - Desugaring and transformations
- Monomorphization - Generic instantiation
- IR - Low-level optimization IR
- Codegen - C code generation
All components are built into the single ve binary for easy distribution.
git clone https://github.com/veil-lang/veil
cd veil
cargo build
./target/debug/ve --helpcargo test # Rust unit tests
cargo check # Check compilation
./target/debug/ve test tests/ # Veil language testsveil/
├── crates/
│ ├── cli/ # ve toolchain (main binary)
│ ├── syntax/ # Parser and grammar
│ ├── ast/ # Abstract syntax tree
│ ├── hir/ # High-level IR
│ ├── resolve/ # Symbol resolution
│ ├── typeck/ # Type checking
│ ├── normalize/ # HIR transformations
│ ├── mono/ # Monomorphization
│ ├── ir/ # Low-level IR
│ ├── codegen-c/ # C code generation
│ └── compiler/ # Pass manager
├── tests/ # Language test suite
├── scripts/ # Installation scripts
└── refs/ # Documentation and specs
We welcome contributions!
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass:
cargo test && ./target/debug/ve test tests/ - Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- GitHub: veil-lang/veil
- Discord: Join our Discord
- Documentation: docs.veil-lang.org
Veil is currently in beta (v0.2.0-beta.4). The language and toolchain are functional but still evolving. We're working towards a stable 1.0 release with:
- ✅ Core language features
- ✅ Self-updating toolchain
- ✅ C code generation
- 🚧 Package management
- 🚧 Standard library
- 🚧 Language server (LSP)
- 🚧 Comprehensive documentation