v2.3.0 Released! πŸš€

The AI-Native
Programming Language.

Ferrite is a compiler-first programming language built specifically for Artificial Intelligence and Machine Learning. Native tensors, compile-time shape verification, compiler-generated automatic differentiation, deterministic execution, and high-performance native binariesβ€”all without external ML frameworks.

tensor_multiply.fe

import "math";

// Compile-time validated tensor shapes
param features: Tensor<float, (100, 784)> = ones();
param weights: Tensor<float, (784, 10)> = rand();

infer {
    // Built-in matrix multiplication operator
    keep logits = features @ weights;
    println("Output shape: " + str(shape(logits)));
}
                    

Why Ferrite?

Why shouldn't I just use Python?

Python + PyTorch


  • Runtime tensor errors
  • Dynamic typing
  • External autodiff
  • Framework-dependent
  • Runtime graph construction

Ferrite


  • Compile-time tensor safety
  • Static typing
  • Compiler-generated autodiff
  • Language-native tensors
  • Compiler optimization
πŸ¦€

Built in Rust

No garbage collector. Blazing fast compiler and runtime core written on top of a type-safe Rust foundation.

🧠

AI Native

Models, tensors and training are language features.

πŸ“

Compile-Time Tensor Safety

Tensor shapes are verified before execution.

⚑

Compiler Optimized

Operator fusion, Memory planning, Static graph optimization

πŸ”’

Deterministic

No hidden randomness. Reproducible training.

Modern Constructs, No Compromise

Ferrite blends systems-level speed with expressive syntax. Write safe pattern-matches, define strict interface contracts via Traits, and manipulate multidimensional data using readable high-level semantics.

  • Structural Pattern Matching with conditional guard clauses
  • First-class functions & lexical closures
  • Safe traits with explicit static implementations
  • No undefined behaviors or runtime reflection lookup errors
Console Output Demo
$ ferrite check model.fe
βœ“ Type check passed in 0.8ms

$ ferrite run model.fe
[Epoch 1/5] loss: 0.4218 - accuracy: 89.2%
[Epoch 2/5] loss: 0.2811 - accuracy: 93.4%
[Epoch 3/5] loss: 0.1989 - accuracy: 96.1%
βœ“ Training completed successfully. Output saved to weights.fe

Get Ferrite Today

Install the Ferrite compiler v2.3.0 natively on your operating system.

πŸͺŸ

Windows

Bundle includes compiler, tree-walk interpreter, and path setup wizard.

Download Installer (.exe)
🍏

macOS

Install via Homebrew tap or download static Apple Silicon/Intel binaries.

brew install vishwanathdvgmm/tap/ferrite
🐧

Linux

Download precompiled binaries or install instantly via curl script.

curl -fsSL https://ferrite-lang.org/install.sh | sh

About Ferrite

The statically-typed, ML-first systems programming language.

Our Mission

Ferrite exists because Artificial Intelligence deserves a programming language designed specifically for itβ€”not a general-purpose language extended with libraries.

Instead of treating tensors, models, and training as runtime abstractions, Ferrite makes them first-class language concepts that the compiler understands, verifies, and optimizes before execution.

Design Philosophy

  • Zero Coercion: No implicit type conversions to prevent silent bugs.
  • ML Native: Tensors with compile-time shape verification.
  • Dual Execution: JIT for fast iteration, AOT for deployment.

The Creator

Created and maintained by Vishwanath M M, built entirely in Rust from the ground up for maximum safety and performance.

Download Ferrite

Get the latest precompiled binaries for your system.

πŸͺŸ

Windows

Requires Windows 10/11 (64-bit)

Download Setup .exe
🍏

macOS

Apple Silicon (M1/M2/M3) & Intel

brew install vishwanathdvgmm/tap/ferrite
🐧

Linux

Ubuntu, Fedora, Arch, etc.

curl -fsSL https://ferrite-lang.org/install.sh | sh

Build from Source

Require a custom build? Make sure you have the Rust toolchain installed.

git clone https://github.com/vishwanathdvgmm/ferrite.git
cd ferrite
cargo build --release

Get Started

Your first steps with Ferrite.

1

Installation

Install Ferrite using the appropriate method for your OS from the Downloads page.

Verify installation:

ferrite --version
2

Write Code

Create a new file named hello.fe and add the following:

keep message: string = "Hello, Ferrite!";
println(message);
3

Run

Execute your program using the interpreter:

ferrite run hello.fe

Expected output: Hello, Ferrite!

Ferrite Tutorial

Learn the language from scratch.

Chapter 1.1: Hello World

Welcome to Ferrite! Let's start with the classic first program.

In Ferrite, you can use the built-in println function to output text to the console.

println("Hello, World!");
Try in Playground β†’

Chapter 1.2: Variables & Types

Ferrite is strictly typed. You must declare the type of a variable. By default, variables are declared with the keep keyword.

keep age: int = 25;
keep name: string = "Ferris";
keep is_active: bool = true;
keep pi: float = 3.14159;

Variables are immutable constants by default. You can reassign them if you want, but their type can never change.

keep count: int = 1;
count = count + 1; // Allowed
// count = "two"; // Error: Type mismatch

Chapter 2.1: If & Else

Conditional logic in Ferrite uses standard if, else if, and else blocks. Note that there are no parentheses around the condition!

keep score = 85;

if score >= 90 {
    println("Grade: A");
} else if score >= 80 {
    println("Grade: B");
} else {
    println("Grade: C");
}

Chapter 2.2: Loops

Ferrite primarily uses while loops for iteration. You can use skip to continue to the next iteration, and stop to break out of the loop.

keep i = 0;
while i < 5 {
    i = i + 1;
    if i == 3 {
        skip; // Skips printing 3
    }
    println("Count: " + str(i));
}

Chapter 3.1: Enums & Match

Ferrite supports powerful algebraic datatypes using enum, and deep pattern matching with the match keyword.

You can also use if clauses inside match arms as "guards" for extra conditions!

enum Result<T> {
    Ok(T);
    Err(string);
}

keep response = Ok(200);

match response {
    case Ok(status) if status == 200 => {
        println("Success!");
    }
    case Ok(status) => {
        println("Other status: " + str(status));
    }
    case Err(msg) => {
        println("Error: " + msg);
    }
}

Chapter 4.1: Groups

Instead of classes or structs, Ferrite uses group to define collections of data.

group Vector2 {
    x: float;
    y: float;
}

keep position = Vector2 { x: 10.5, y: 20.0 };
println("X Coordinate: " + str(position.x));

Chapter 4.2: Traits (Interfaces)

A trait defines shared behavior (like an interface). You can then use the impl block to implement that behavior for a specific group.

trait Display {
    fun format(self) -> string;
}

impl Display for Vector2 {
    fun format(self) -> string {
        return "Vec2(" + str(self.x) + ", " + str(self.y) + ")";
    }
}

println(position.format());

Chapter 5.1: Tensors

Tensors are native primitives in Ferrite. When you declare a Tensor, you specify its shape in the type signature. The compiler checks these shapes during compile time!

import "math";

// Define a 1x4 input tensor and a 4x2 weights tensor
param inputs: Tensor<float, (1, 4)> = rand(1, 4);
param weights: Tensor<float, (4, 2)> = ones(4, 2);

// Matrix multiplication using the @ operator
// Resulting shape will automatically be (1, 2)
keep outputs = inputs @ weights;

Chapter 5.2: Execution Blocks

Ferrite uses specialized contexts for ML operations. For example, infer {} blocks optimize execution for pure feed-forward passes by disabling gradient tracking overhead.

infer {
    keep outputs = inputs @ weights;
    println("Outputs: " + str(outputs));
}

train {
    // Operations here will track gradients
    keep loss = compute_gradients(inputs);
}

Examples

  • ✨ New File
  • 1. Hello, Ferrite!
  • 2. Tensor Multiplications
  • 3. Match Guards & Enums
  • 4. Traits & Groups
  • 5. Closures & Loops

Note: This is a client-side execution environment for Ferrite code. Some heavy tensor operations may run slower than native.

sandbox.fe
1
2
3
4
5
Console Output
// Press 'Run Code' to execute sandbox.fe...

Introduction to Ferrite

Ferrite is a statically-typed, ahead-of-time compiled, systems programming language specifically optimized for machine learning computation, built from the ground up in Rust.

Unlike languages like Python, which are slow and dynamically typed, or C++/Rust, which require complex bindings for tensor libraries, Ferrite treats tensors as first-class primitives with strict compile-time shape validation.

Core Pillars

Feature Details
No Implicit Coercion Types do not cast silently. Adding an int to a float requires explicit cast helper functions.
AOT + JIT Execution Runs dynamically via a Tree-Walk interpreter, or builds directly to native assemblies.
Native Tensors Compile-time shape validation prevents dimension mismatches before deployment.

Installation & Setup

Ferrite provides standalone precompiled binaries with no external runtime dependencies. Select your platform below for installation guidelines.

Windows

Download and run the custom setup wizard: ferrite-v2.3.0-setup.exe. The wizard will install the compiler and automatically configure your environment variables.

macOS

Install Ferrite using our official Homebrew tap:


# Add the tap and install
brew tap vishwanathdvgmm/tap
brew install ferrite
                            

Alternatively, download the `.tar.gz` archive for Apple Silicon (M1/M2/M3) or Intel architectures from our Releases page, extract it, and copy `ferrite` to `/usr/local/bin`.

Linux

Run the automated shell install script in your terminal:


curl -fsSL https://ferrite-lang.org/install.sh | sh
                            

Or download the precompiled binary from the Releases page, extract it, and add it to your path:


tar -xzf ferrite-v2.3.0-linux-x86_64.tar.gz
sudo mv ferrite /usr/local/bin/
                            

Build from Source

Ferrite can be compiled from source on any system running a modern Rust compiler toolchain:


# Clone the repository
git clone https://github.com/vishwanathdvgmm/ferrite.git
cd ferrite

# Build the release binary
cargo build --release

# Run a quick sanity check
./target/release/ferrite run tests/hello.fe
                            

Command Line Interface

The ferrite compiler binary includes utility subcommands for testing, executing, and type-checking scripts.

Command Syntax


# Syntax-check and type-check a program without running it
ferrite check my_code.fe

# Interpret a file instantly using the Tree-Walk engine
ferrite run my_code.fe

# Print help manuals and release versions
ferrite --help
ferrite --version
                            

Variables & Mutability

By default, variables declared in Ferrite are **immutable (read-only constants)** using the keep keyword. Mutable variables can be updated using normal reassignment syntax.

Declaration Examples


// Keep defines immutable constants
keep pi: float = 3.14159;
keep welcome: string = "Hello, System!";

// Mutable variables (assigned directly)
keep count: int = 10;
count = count + 1; // Works!

// Error: Cannot reassign an immutable keep once initialized
pi = 3.20; 
                            

Strict Type System

Ferrite implements absolute type safety. There is no concept of "truthiness" (e.g. if 1 is a compile error) and no silent numeric upgrades (e.g., passing an int into a function parameter expecting a float fails immediately).

Primitive Types

  • int: 64-bit signed integer.
  • float: 64-bit floating-point number.
  • bool: Boolean values (true or false).
  • string: UTF-8 character arrays.
  • fun: First-class function handle signatures.
  • Tensor: Multi-dimensional numeric arrays.

Casting Rules


keep x: int = 5;
keep y: float = 2.5;

// Fails: Types do not align (int + float)
keep z = x + y; 

// Success: Cast x explicitly to a float first
keep correct = float(x) + y;
                            

Loops & Control Flow

Ferrite supports conditional blocks and iteration loops with advanced jump controls like skip (continue) and stop (break).

Conditional branching


keep temperature: float = 38.5;

if temperature > 37.5 {
    println("Fever warning");
} else {
    println("Normal temperature");
}
                            

While Loops


keep i: int = 0;
while i < 10 {
    i = i + 1;
    if i == 3 { 
        skip; // Skip remaining block and continue loop
    }
    if i == 7 { 
        stop; // Break out of loop
    }
    println(str(i));
}
                            

Pattern Matching & Guards

Ferrite supports deep algebraic matching on Enum datatypes, featuring conditional guard clauses via the if keyword inside cases.

Match syntax


enum Result<T> {
    Ok(T);
    Err(string);
}

keep response = Ok(200);

match response {
    case Ok(status) if status == 200 => {
        println("Success code: " + str(status));
    }
    case Ok(status) => {
        println("Other OK status");
    }
    case Err(msg) => {
        println("Failure: " + msg);
    }
}
                            

Groups & Traits

Data containers are defined using group. Interfaces or shared protocols are declared using trait, which can be implemented explicitly on groups using the impl block.

Defining Structure and Interfaces


group Vector2 {
    x: float;
    y: float;
}

trait Display {
    fun format(self) -> string;
}

impl Display for Vector2 {
    fun format(self) -> string {
        return "Vector2(" + str(self.x) + ", " + str(self.y) + ")";
    }
}
                            

ML & Tensor Operations

Tensors are native primitives in Ferrite. Shapes are specified within the generic parameters and are enforced during type checking to prevent out-of-bounds layer math.

Compile-Time Shape Constraints


// Declare shapes (batch_size, inputs) and (inputs, outputs)
param batch: Tensor<float, (32, 128)> = rand();
param weights: Tensor<float, (128, 64)> = zeros();

// The @ symbol indicates matrix multiplication
keep activations = batch @ weights; // Compiles (result shape: 32, 64)

// Error: Shape mismatch at check-time! (128x64 cannot multiply 32x128)
keep invalid = weights @ batch;
                            

Execution Blocks (train / infer)

Isolate your operations inside context blocks which optimize execution parameters (e.g. tracking gradients, disabling backpropagation overheads):


train {
    // Gradients are calculated automatically
    keep loss = compute_gradients(batch);
}

infer {
    // Pure feed-forward path optimized for speed
    keep output = forward_pass(batch);
}
                            

Standard Library

Ferrite includes a curated set of native core libraries accessible via the `import` command.

Available modules

  • "math": Trigonometric calculations, matrix algebra tools, distributions.
  • "system": Direct environment querying, file reading/writing buffers.
  • "tensors": High-level utility routines (reshaping, slicing, normalizations).
🚧 Coming Soon

Ferrite Package Registry

A built-in package manager is on the roadmap. Soon you'll be able to discover, install, and publish Ferrite libraries with a single command.

Planned CLI Preview

Here's what fe-pkg will look like when it ships:

# Initialize a new Ferrite project $ fe-pkg init my-project
βœ“ Created ferrite.toml
# Add a package dependency $ fe-pkg add nn
Resolving nn v1.x...
βœ“ Package added to ferrite.toml
# Publish your own library $ fe-pkg publish
βœ“ Module uploaded to registry.

πŸ“‹ Roadmap

Done

Core Language

Lexer, parser, type checker, and tree-walk interpreter are live and working.

Done

Online Playground

Run Ferrite code directly in your browser with real-time output.

In Progress

Module System

Import/export, module resolution, and namespace management for multi-file projects.

Planned

Package Manager (fe-pkg)

Dependency resolution, version pinning, ferrite.toml manifest, and a global registry.

Planned

Standard Library

Core packages for I/O, math, networking, data structures, and ML primitives.

πŸ“¬

Want to be notified when packages launch?

Star the GitHub repo to get release notifications, or follow the blog for updates.

Ecosystem & Release Blog

Stay up to date with the latest features, releases, and guides from the Ferrite core team.

Announcing Ferrite v2.3.0: Closures, Guards, & Setup Wizards

We are excited to release Ferrite v2.3.0! This release is packed with compiler features, syntax improvements, and ecosystem setups. Highlights include lexical closures, enum guard clauses, skip/stop loops control, and the new setup wizard.

Lexical Closures

First-class functions can now capture variables from their outer scope. This unlocks functional programming patterns directly in Ferrite:


keep multiplier = 2;
keep double: fun(int)->int = (x: int) => x * multiplier;
                                

Advanced Loop Control

We added `skip` and `stop` keywords, aligning Ferrite's iteration structure with standard loop controls (corresponding to `continue` and `break` in traditional C-like syntaxes).

New Setup Installer

Our Windows installation experience has been rewritten. The setup wizard now properly publishes vendor parameters, configures environment paths, and resolves standard SDK files directly.

Ferrite v2.2.0: Hardened Type Checks & Traits

Ferrite's compiler type check has been hardened. We've introduced explicit interfaces called Traits, which can be custom-implemented on structural Groups to support clean code architectures.

Traits establish code contract standards. In this release, the static analyzer ensures that all trait functions are fully implemented, preventing runtime resolution errors in native compiled binaries.

Why We Built Ferrite: An ML-First Systems Language

In this post, we discuss the design philosophy behind Ferrite, how it handles compilation pathways, and why compiled tensor validation is the future of neural network engineering.

Traditional machine learning flows suffer from "shape bugs" that arise hours into training. Ferrite's strict compiler verifies matrix sizes *before* compilation, saving GPU resources and developer time.