

















amalgame v0.8.52 · just released
A statically-typed language that compiles to portable C, then to a real native binary. Self-hosted, cross-platform.
curl -sSL https://amalgame.me/install.sh | sh
namespace App import Amalgame.IO public class Greeter { public Name: string public Greeter(string name) { this.Name = name } public string Hello() { guard String.Length(this.Name) > 0 else { return "Hello, stranger!" } return "Hello, {this.Name}!" } }
Pattern matching, null-safety, lambdas, comprehensions, generics. Modern ergonomics, at native C speed.
The amc compiler is written in Amalgame and rebuilds itself in five seconds, test suite included.
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.
Linux, macOS, Windows. Binaries published on every tag.
⚡ AI-ready, built into the compiler
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 · MigrateAuto-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 · GenerateFrom a natural-language prompt to idiomatic Amalgame. Streaming via the claude CLI for direct stdout passthrough — perfect for scaffolding a starting point.
amc explain · ExplainReverse 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
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
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 addClone, validate and record a dependency. On indexed shortnames, the tag is optional: amc auto-resolves the latest version compatible with your amc.
amc package searchSubstring match against the curated index (30-min cache). Lists every known tag with compat status (✓/✗) and a ← latest compatible marker.
amalgame.tomlMinimal 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
amc test auto-installs missing deps. Public index: github.com/amalgame-lang/packages-index — PR to publish your package.
✓ Tests built into the compiler
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-discoveryamc 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.
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
amc fmt re-emits the AST canonically (idempotent). amc --lint flags dead code, unused locals, shadowing — non-fatal.
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。