freshcrate
Home > Uncategorized > almide

almide

A functional programming language optimized for LLM code generation. Compiles to Rust and WebAssembly.

Description

A functional programming language optimized for LLM code generation. Compiles to Rust and WebAssembly.

README

Almide

Almide

A programming language designed for LLM code generation.

Playground ยท Specification ยท Grammar ยท Cheatsheet ยท Design Philosophy

CI License: MIT / Apache-2.0 Ask DeepWiki

What is Almide?

Almide is a statically-typed language optimized for AI-generated code. It compiles to native binaries (via Rust) and WebAssembly.

The core metric is modification survival rate โ€” how often code still compiles and passes tests after a series of AI-driven modifications. The language achieves this through unambiguous syntax, actionable compiler diagnostics, and a standard library that covers common patterns out of the box.

The flywheel: LLMs write Almide reliably โ†’ more code is produced โ†’ training data grows โ†’ LLMs write it better โ†’ the ecosystem expands.

Quick Start

Try it in your browser โ†’ โ€” No installation required.

Install (macOS / Linux)

curl -fsSL https://raw.githubusercontent.com/almide/almide/main/tools/install.sh | sh

Install (Windows)

irm https://raw.githubusercontent.com/almide/almide/main/tools/install.ps1 | iex

Install from source

Requires Rust (stable, 1.89+):

git clone https://github.com/almide/almide.git
cd almide
cargo build --release
cp target/release/almide ~/.local/bin/

Hello World

fn main() -> Unit = {
  println("Hello, world!")
}
almide run hello.almd

Features

  • Multi-target โ€” Same source compiles to native binary (via Rust) or WebAssembly (direct emit)
  • Generics โ€” Functions (fn id[T](x: T) -> T), records, variant types, recursive variants with auto Box wrapping
  • Pattern matching โ€” Exhaustive match with variant destructuring
  • Effect functions โ€” effect fn for explicit error propagation (Result auto-wrapping)
  • Bidirectional type inference โ€” Type annotations flow into expressions (let xs: List[Int] = [])
  • Codec system โ€” Type.decode(value) / Type.encode(value) convention with auto-derive
  • Map literals โ€” ["key": value] syntax with m[key] access and for (k, v) in m iteration
  • Fan concurrency โ€” fan { a(); b() }, fan.map, fan.race, fan.any, fan.settle
  • Top-level constants โ€” let PI = 3.14 at module scope, compile-time evaluated
  • Pipeline operator โ€” data |> transform |> output
  • Module system โ€” Packages, sub-namespaces, visibility control, diamond dependency resolution
  • Standard library โ€” 430 functions across 23 modules (string, list, map, json, http, fs, etc.)
  • Built-in testing โ€” test "name" { assert_eq(a, b) } with almide test
  • Actionable diagnostics โ€” Every error includes file:line, context, and a concrete fix suggestion

Why Almide?

  • Predictable โ€” One canonical way to express each concept, reducing token branching for LLMs
  • Local โ€” Understanding any piece of code requires only nearby context
  • Repairable โ€” Compiler diagnostics guide toward a specific fix, not multiple possibilities
  • Compact โ€” High semantic density, low syntactic noise

For the full design rationale, see Design Philosophy.

Example

let PI = 3.14159265358979323846
let SOLAR_MASS = 4.0 * PI * PI

type Tree[T] =
  | Leaf(T)
  | Node(Tree[T], Tree[T])

fn tree_sum(t: Tree[Int]) -> Int =
  match t {
    Leaf(v) => v
    Node(left, right) => tree_sum(left) + tree_sum(right)
  }

effect fn greet(name: String) -> Result[Unit, String] = {
  guard string.len(name) > 0 else err("empty name")
  println("Hello, ${name}!")
  ok(())
}

effect fn main() -> Result[Unit, String] = {
  greet("world")
}

test "greet succeeds" {
  assert_eq("hello".len(), 5)
}

How It Works

Almide source (.almd) is compiled by a pure-Rust compiler through a three-layer codegen architecture:

.almd โ†’ Lexer โ†’ Parser โ†’ AST โ†’ Type Checker โ†’ Lowering โ†’ IR
                                                            โ†“
                                              Nanopass Pipeline (semantic rewrites)
                                                            โ†“
                                              Template Renderer (TOML-driven)
                                                            โ†“
                                                    .rs / .wasm

The Nanopass pipeline applies target-specific transformations: ResultPropagation (Rust ?), CloneInsertion (Rust borrow analysis), LICM (loop-invariant code motion). The Template Renderer is purely syntactic โ€” all semantic decisions are already encoded in the IR.

almide run app.almd              # Compile + execute (Rust target)
almide run app.almd -- arg1      # With arguments
almide build app.almd -o app     # Build standalone binary
almide build app.almd --target wasm  # Build WebAssembly (WASI)
almide compile                   # Compile to .almdi (module interface + IR)
almide compile parser            # Compile a specific module
almide compile --json            # Output interface as JSON
almide test                      # Find and run all test blocks (recursive)
almide test spec/lang/           # Run tests in a directory
almide test --run "pattern"      # Filter tests by name
almide check app.almd            # Type check only
almide check app.almd --json     # Type check with JSON output
almide fmt app.almd              # Format source code
almide clean                     # Clear build + dependency cache

WASM Binary Size

Almide emits WASM bytecode directly (no Rust/C intermediary). Each binary is self-contained โ€” allocator, string handling, and runtime are all included. No external GC or host runtime dependency.

Program Binary Size
Hello World 2,368 B
FizzBuzz 2,662 B
Fibonacci 2,699 B
Closure 2,894 B
Variant 3,391 B

Native Performance

Almide compiles to Rust, which then compiles to native machine code. No runtime, no GC, no interpreter.

Metric Value
Binary size (minigit CLI) 444 KB (stripped)
Runtime (100 ops) 1.1s
Dependencies 0 (single static binary)
WASM target almide build app.almd --target wasm

Project Status

Category Status
Compiler Pure Rust, single binary, 0 ICE
Targets Rust (native), WASM (direct emit)
Codegen v3 โ€” Nanopass + TOML templates, fully target-agnostic walker
Stdlib 430 functions across 23 modules
Tests 177 test files pass (Rust), 278 pass (WASM)
MSR 23/25 exercises pass (Sonnet 4.6, WASM, max 3 attempts)
MiniGit Bench 41/41 tests pass, 100% success rate (ai-coding-lang-bench)
Artifacts .almdi module interface files via almide compile
Playground Live โ€” compiler runs as WASM in browser

AI Coding Language Benchmark

Comparison with 15 established languages using mame/ai-coding-lang-bench (MiniGit implementation task).

Execution Time Code Size Pass Rate

Almide uses Sonnet 4.6 (unknown language); all others use Opus 4.6 (known language). Almide achieves 100% pass rate with fewer lines of code than most languages, despite needing more time due to the model having no prior training data for the language.

Ecosystem

Grammar โ€” almide-grammar

Single source of truth for Almide syntax โ€” keywords, operators, precedence, and TextMate scopes. Written in Almide itself.

All tools that need to know Almide's syntax import this module rather than maintaining their own keyword lists:

# almide.toml
[dependencies]
almide-grammar = { git = "https://github.com/almide/almide-grammar", tag = "v0.1.0" }
import almide_grammar
almide_grammar.keyword_groups()    // 6 groups, 41 keywords
almide_grammar.precedence_table()  // 8 levels, pipe โ†’ unary

The compiler itself uses almide-grammar's TOML files (tokens.toml, precedence.toml) at build time to generate its lexer keyword table โ€” ensuring the compiler and all tooling stay in sync.

Editor Support

  • VS Code โ€” vscode-almide โ€” Syntax highlighting, bracket matching, comment toggling, code folding
  • Tree-sitter โ€” tree-sitter-almide โ€” Tree-sitter grammar for editors that support it (Neovim, Helix, Zed)

Playground โ€” playground

Browser-based compiler and runner. The Almide compiler runs as WASM โ€” no server, no installation. Try it at almide.github.io/playground.

Documentation

Contributing

Contributions are welcome! Please open an issue or pull request on GitHub.

After cloning, install the git hooks:

brew install lefthook  # macOS; see https://github.com/evilmartians/lefthook for other platforms
lefthook install

All commits must be in English (enforced by the commit-msg hook). See CLAUDE.md for project conventions.

License

Licensed under either of MIT or Apache 2.0 at your option.

Release History

VersionChangesUrgencyDate
v0.15.0## What's Changed * Add almide-egg-lab feasibility PoC by @O6lvl4 in https://github.com/almide/almide/pull/171 * Bridge IrExpr to egg for real-IR fusion by @O6lvl4 in https://github.com/almide/almide/pull/172 * egg-lab: lower RecExpr back to IrExpr with fresh-VarId compose beta-reduction by @O6lvl4 in https://github.com/almide/almide/pull/173 * Parse generic @name(args) attributes as Stage 1a of Stdlib Unification by @O6lvl4 in https://github.com/almide/almide/pull/174 * Stdlib Unification StageHigh4/20/2026
v0.14.8Hotfix for a v0.14.7 regression: external package dispatch (e.g. `almai` loaded from `[dependencies]` in `almide.toml`) failed to link because the Phase 1b `ResolveCallsPass` rewrote every `CallTarget::Module` โ€” including user-package modules โ€” to a non-versioned mangled name. The walker then emitted those functions under their versioned identifier (`almide_rt_<pkg>_v<major>_<fn>`) while the call sites referenced the unversioned form (`almide_rt_<pkg>_<fn>`), producing Rust E0425 at compile timeHigh4/16/2026
v0.14.5## Highlights From almide-dojo data (v0.14.4 run): 7/13 failures on `llama-3.3-70b` came from the LLM writing idioms of **other languages** and getting a generic `Expected ...` error with no Almide-specific clue. This release detects the specific patterns and emits a targeted hint. - **`let x = 1 in expr`** (OCaml / Haskell) โ†’ `` `let ... in <expr>` is OCaml/Haskell syntax `` + newline-separated example of the Almide form. - **`let rec name(args) = ...`** (OCaml / SML) โ†’ `` `let rec` is OCaml/High4/15/2026
v0.14.2## What's Changed * Fix TCO/BorrowInsertion call-site mismatch for String params by @O6lvl4 in https://github.com/almide/almide/pull/155 * Improve diagnostics: assignment-in-expression and Unit-vs-List by @O6lvl4 in https://github.com/almide/almide/pull/156 * Record stdlib coverage audit + ideal named-type design by @O6lvl4 in https://github.com/almide/almide/pull/157 * Cover all 32 previously-untested matrix stdlib functions by @O6lvl4 in https://github.com/almide/almide/pull/158 * Parse [[typeHigh4/14/2026
v0.14.0## Highlights Almide's matrix runtime now matches or beats NumPy on every transformer primitive we measured, while keeping the language unchanged โ€” all gains come from stdlib/runtime additions. ### Benchmarks on Apple Silicon (f32) | Workload | Almide | NumPy | Ratio | |---|---|---|---| | Single matmul 3ยฒ-1024ยฒ (f32 & f64) | โ€” | โ€” | All sizes Almide 1.03-38x | | Chained matmul (2 ops) | โ€” | โ€” | All sizes Almide 1.02-1.12x | | Full MLP: `gelu(X @ W1 + b1) @ W2 + b2` | | | Almide **1.20-1.30x**High4/14/2026
v0.13.2## What's Changed ### Documentation Overhaul - **ARCHITECTURE.md** rewritten to reflect the 9-crate workspace structure (72k lines). Removed stale references to the removed TypeScript codegen. - **CHEATSHEET.md** stdlib function counts corrected. Removed phantom modules (`path`, `args`) that had docs without implementations. - **SPEC.md** TypeScript/JavaScript codegen references removed. Cross-target semantics updated to Rust / WASM only. - **Stdlib docs**: added missing functions in `bytes` (High4/10/2026
v0.13.1## What's Changed ### Windows CI Fix `process.kill` / `process.is_alive` runtime functions now work on Windows: - **Unix**: `kill -<signal> <pid>` / `kill -0 <pid>` - **Windows**: `taskkill /PID <pid> /F` / `tasklist /FI "PID eq <pid>"` Tests updated for cross-platform compatibility (`HOME` โ†’ `USERPROFILE` fallback, `sleep` โ†’ `ping` on Windows). **Full Changelog**: https://github.com/almide/almide/compare/v0.13.0...v0.13.1High4/8/2026

Dependencies & License Audit

Loading dependencies...

Similar Packages

SignSign integrity generic notationmain@2026-04-20
blitzA pure-Rust x86-64 compiler backend with e-graph optimization as coremaster@2026-04-17
alefGenerate fully-typed, lint-clean language bindings for Rust libraries across 11 languagesv0.4.4
JargonJargon is a self-hosting compiled programming language that targets LLVM IR and produces native executables on Windows. master@2026-04-19
typedqliserAdd formal type safety (10 levels, dependent/linear/session types) to any query language โ€” SQL, GraphQL, Cypher, SPARQL, VQLmain@2026-04-18