Transpiler : The best of every language, in one

bmouget1 pts0 comments

Amalgame — The best of every language, in one.

amalgame v0.8.52 · just released

The best of every language,

in one.

A statically-typed language that compiles to portable C, then to a real native binary. Self-hosted, cross-platform.

Get started<br>See the tour

curl -sSL https://amalgame.me/install.sh | sh<br>copy

namespace App<br>import Amalgame.IO

public class Greeter {<br>public Name: string

public Greeter(string name) {<br>this.Name = name

public string Hello() {<br>guard String.Length(this.Name) > 0 else {<br>return "Hello, stranger!"<br>return "Hello, {this.Name}!"

At a glance

Pattern matching, null-safety, lambdas, comprehensions, generics. Modern ergonomics, at native C speed.

Self-hosted

The amc compiler is written in Amalgame and rebuilds itself in five seconds, test suite included.

Compiles to C, then to a real binary

amc emits readable C, then gcc turns it into a standard native executable. A real binary, deployable like any C program, with no Amalgame install needed on the user's machine.

Cross-platform

Linux, macOS, Windows. Binaries published on every tag.

Read the docs<br>See all releases

⚡ AI-ready, built into the compiler<br>AI is not a plug-in, it's an amc command

The amc compiler ships three LLM-driven subcommands: migrate from 21 source languages to Amalgame, generate from a prompt, and explain a .am file in natural language. Pick the provider (Anthropic, OpenAI, Google) with your own API key — no Amalgame server between you and the LLM.

amc migrate · Migrate

Auto-detects 21 source languages (TS, Python, Java, C#, Go, Rust…) by extension. Directory recursion, SHA-256 cache, automated amc --check validation, --dry-run cost estimation.

amc generate · Generate

From a natural-language prompt to idiomatic Amalgame. Streaming via the claude CLI for direct stdout passthrough — perfect for scaffolding a starting point.

amc explain · Explain

Reverse direction: emit a natural-language explanation of a .am file. Use --lang to translate the explanation into any language. Great for legacy code, onboarding, review.

amc migrate app.ts · amc generate "REST CRUD users" · amc explain main.am<br>copy

Providers: ANTHROPIC_API_KEY → Claude · OPENAI_API_KEY → ChatGPT · GEMINI_API_KEY → Gemini · fallback claude CLI. Details in docs/guide/08-llm-commands.md.

📦 Native package manager<br>A built-in package manager, not a third-party tool

amc package (alias amc pkg) handles dependencies like cargo or npm: TOML manifest, lockfile, curated index, automatic resolution of the latest compatible version. Packages vendor their own C/C++ runtime — backends like SQLite or DuckDB link with zero effort.

amc package add

Clone, validate and record a dependency. On indexed shortnames, the tag is optional: amc auto-resolves the latest version compatible with your amc.

amc package search

Substring match against the curated index (30-min cache). Lists every known tag with compat status (✓/✗) and a ← latest compatible marker.

amalgame.toml

Minimal manifest: [package] (name, version, required-amalgame), [dependencies], and for libs [stdlib] (header, C/C++ sources, cflags, libs). amalgame.lock for reproducibility.

amc package add duckdb · amc package list · amc test<br>copy

amc test auto-installs missing deps. Public index: github.com/amalgame-lang/packages-index — PR to publish your package.

✓ Tests built into the compiler<br>One command, zero framework, 480/480

The amc compiler ships its own test runner: amc test discovers *_test.am files, compiles them, runs them, aggregates results. No DSL, no macros, no external runner. The compiler itself is validated by 480 tests through that same command.

amc test · Auto-discovery

amc test walks the current dir (or the one you pass), finds every *_test.am file, compiles and runs them in parallel. Exits non-zero if a single case fails or any file fails to compile.

[PASS] [FAIL] [SKIP]

No framework to learn. Every test file is a regular Amalgame program that prints [PASS]/[FAIL]/[SKIP] from Main. amc parses stdout and aggregates. You write assertions in plain Amalgame code, that's it.

CI-friendly

Deterministic, grep-able output. Exit code propagates to any pipeline (GitHub Actions, GitLab CI, etc.). Auto-installs package dependencies before running the suite.

amc test · amc test ./tests/lexer · amc fmt -w src/ · amc --lint src/main.am<br>copy

amc fmt re-emits the AST canonically (idempotent). amc --lint flags dead code, unused locals, shadowing — non-fatal.

© Bastien Mouget · Apache 2.0

Current version: v0.8.52

This site uses an anonymous analytics cookie (Google Analytics) to understand audience. No ads, no cross-site tracking.

Decline<br>Accept

amalgame test package language name compiler

Related Articles