{"id":49795296,"url":"https://github.com/amalgame-lang/amalgame","last_synced_at":"2026-05-31T10:00:35.612Z","repository":{"id":353313607,"uuid":"1218865286","full_name":"amalgame-lang/Amalgame","owner":"amalgame-lang","description":"A self-hosted programming language that compiles to C, then to a real native binary. The best of every language, in one.","archived":false,"fork":false,"pushed_at":"2026-05-24T22:52:41.000Z","size":14082,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-25T00:32:53.259Z","etag":null,"topics":["c-compiler","compiler","language-design","null-safety","pattern-matching","programming-language","self-hosted","static-typing","transpiler","vala-bootstrap"],"latest_commit_sha":null,"homepage":"https://amalgame.me","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/amalgame-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":"ROADMAP_COMPLET.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE.md","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-04-23T09:40:28.000Z","updated_at":"2026-05-24T22:52:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"1541409a-6752-46b3-9863-7b2529282e06","html_url":"https://github.com/amalgame-lang/Amalgame","commit_stats":null,"previous_names":["neitsabteguom/code","bastienmouget/amalgame","amalgame-lang/amalgame"],"tags_count":101,"template":false,"template_full_name":null,"purl":"pkg:github/amalgame-lang/Amalgame","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalgame-lang%2FAmalgame","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalgame-lang%2FAmalgame/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalgame-lang%2FAmalgame/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalgame-lang%2FAmalgame/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amalgame-lang","download_url":"https://codeload.github.com/amalgame-lang/Amalgame/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalgame-lang%2FAmalgame/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33726719,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-31T02:00:06.040Z","response_time":95,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-compiler","compiler","language-design","null-safety","pattern-matching","programming-language","self-hosted","static-typing","transpiler","vala-bootstrap"],"created_at":"2026-05-12T09:00:56.684Z","updated_at":"2026-05-31T10:00:35.599Z","avatar_url":"https://github.com/amalgame-lang.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n\n\u003cimg src=\"assets/logo.svg\" alt=\"Amalgame logo\" width=\"240\" /\u003e\n\n# Amalgame\n\nA self-hosted programming language that compiles to C.\n\n[![CI](https://github.com/amalgame-lang/Amalgame/actions/workflows/ci.yml/badge.svg)](https://github.com/amalgame-lang/Amalgame/actions/workflows/ci.yml)\n[![Self-hosted](https://img.shields.io/badge/compiler-self--hosted-success)](src/)\n[![Tests](https://img.shields.io/badge/tests-363%2F363-brightgreen)](tests/)\n[![License: Apache 2.0](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](LICENSE)\n[![Platform](https://img.shields.io/badge/platform-Linux%20%7C%20macOS%20%7C%20Windows-lightgrey)]()\n\n\u003c/div\u003e\n\n\u003e Site officiel : **[amalgame.me](https://amalgame.me)**\n\u003e [Tour du langage](https://amalgame.me/fr/tour) · [Installer](https://amalgame.me/fr/install) · [Versions](https://amalgame.me/fr/releases)\n\n```kotlin\nnamespace App\nimport Amalgame.IO\n\npublic class Greeter {\n    public Name: string\n\n    public Greeter(string name) {\n        this.Name = name\n    }\n\n    public string Hello() {\n        guard String.Length(this.Name) \u003e 0 else { return \"Hello, stranger!\" }\n        return \"Hello, {this.Name}!\"\n    }\n}\n```\n\n## Overview\n\nAmalgame is a small, statically-typed language whose compiler (`amc`)\nis written in Amalgame and emits portable C. The runtime is a thin\nheader-only layer over libc, libgc (Boehm GC) and libcurl.\n\n- **Self-hosted.** The compiler bootstraps itself in about five\n  seconds. A tracked `snapshot/amc_lib.c` (known-good portable C)\n  is the cold-start entry point — one `gcc` invocation rebuilds the\n  bootstrap binary on any platform.\n- **Predictable output.** Source maps cleanly to C. Strings are\n  `char*`, lists are `void**` arrays, integers are `i64`. No VM, no\n  hidden allocations beyond the GC. Generated C is `gcc`-buildable\n  with `-O2`.\n- **Multi-platform.** Linux, macOS, and Windows binaries are produced\n  on every `v*` tag. Windows is supported via MinGW (Winsock under\n  `#ifdef _WIN32` in the runtime).\n\nCurrent version: **v0.8.25**.\n\n## Language at a glance\n\n```kotlin\nnamespace App\nimport Amalgame.IO\n\npublic enum Shape {\n    Circle(int)\n    Rect(int, int)\n}\n\npublic class Program {\n    public static void Main(string[] args) {\n        // Match as expression with arm guards and ranges\n        let n = 42\n        let bucket = match n {\n            0           =\u003e \"zero\"\n            x if x \u003c 0  =\u003e \"negative\"\n            1..9        =\u003e \"small\"\n            10..99      =\u003e \"medium\"\n            _           =\u003e \"large\"\n        }\n        Console.WriteLine(bucket)\n\n        // List comprehension\n        let squares = [i * i for i in 0..10 if i % 2 == 0]\n        Console.WriteLine(String.FromInt(squares.Count()))\n\n        // Tuple destructuring\n        let (q, r) = Program.DivMod(17, 5)\n        Console.WriteLine(\"{String.FromInt(q)} rem {String.FromInt(r)}\")\n\n        // Algebraic enum + destructuring\n        let s = Shape.Circle(5)\n        match s {\n            Circle(r)  =\u003e Console.WriteLine(\"r={String.FromInt(r)}\")\n            Rect(w, h) =\u003e Console.WriteLine(\"rect\")\n        }\n\n        // Null-safe member access\n        let maybe: Greeter? = null\n        let label = maybe?.Hello()\n        if (label == null) { Console.WriteLine(\"no greeter\") }\n    }\n\n    public static (int, int) DivMod(int a, int b) {\n        return (a / b, a % b)\n    }\n}\n```\n\nA more thorough tour is in [docs/guide/02-language-tour.md](docs/guide/02-language-tour.md).\n\n## Getting started\n\n### Linux\n\n```bash\nsudo apt install gcc libgc-dev libcurl4-openssl-dev\ngit clone https://github.com/amalgame-lang/Amalgame.git \u0026\u0026 cd Amalgame\ngcc -O2 -Iruntime snapshot/amc_lib.c -lgc -lm -lcurl -o snapshot/amc\n./build_amc.sh           # builds ./amc from src/ via the snapshot\n./amc --version          # amc 0.4.14\n./tests/run_all_tests.sh\n```\n\n### macOS\n\n```bash\nbrew install bdw-gc curl\ngit clone https://github.com/amalgame-lang/Amalgame.git \u0026\u0026 cd Amalgame\nGC_PREFIX=$(brew --prefix bdw-gc)\nCURL_PREFIX=$(brew --prefix curl)\ngcc -O2 -Iruntime -I\"$GC_PREFIX/include\" -I\"$CURL_PREFIX/include\" \\\n    -L\"$GC_PREFIX/lib\" -L\"$CURL_PREFIX/lib\" \\\n    snapshot/amc_lib.c -lgc -lm -lcurl -o amc\n./amc --version\n```\n\n### Windows (MSYS2 MINGW64)\n\n```bash\npacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gc mingw-w64-x86_64-curl\ngit clone https://github.com/amalgame-lang/Amalgame.git \u0026\u0026 cd Amalgame\ngcc -O2 -Iruntime snapshot/amc_lib.c -lgc -lm -lcurl -lws2_32 -o amc.exe\n./amc.exe --version\n```\n\n### Hello, world\n\n```kotlin\n// hello.am\nnamespace App\nimport Amalgame.IO\n\npublic class Program {\n    public static void Main(string[] args) {\n        Console.WriteLine(\"Hello, Amalgame!\")\n    }\n}\n```\n\n```bash\n./amc hello.am -o hello\ngcc -Iruntime hello.c -lgc -lm -lcurl -o hello\n./hello\n# → Hello, Amalgame!\n```\n\n## What's in the language\n\n- Variables (`let` / `var`) with optional type annotation\n- Primitives: `int`, `float`, `double`, `bool`, `string`, `void`\n- Classes with inheritance, interfaces, data classes, records\n- Enums (simple) and algebraic enums with destructuring\n- Generics (erased to `void*` at the C level)\n- Null-safety: `T?`, `??` coalescing, `?.` safe member access\n- Tuples and destructuring: `let (a, b) = f()`\n- Pattern matching with guards, ranges, binders, statement-shaped\n  arms (`return`, `break`, `continue`)\n- `match` and `if` as expressions\n- List comprehensions: `[x*2 for x in xs if x \u003e 0]`\n- String interpolation: `\"hello {x}\"`\n- Triple-quoted multiline strings: `\"\"\"…\"\"\"`\n- `\\xHH` and `\\uHHHH` escape sequences\n- Bitwise operators, compound assignments, pipeline `|\u003e`, range `0..n`\n- Guard clauses: `guard cond else { return }`\n- Decorators (`@inline`, `@deprecated`) mapped to GCC attributes\n- Capturing closures (since v0.3.4) — multi-param `(x,y) =\u003e …` and\n  block bodies `x =\u003e { … }` since v0.3.5\n- Higher-order list methods — `xs.Filter / .Map / .Reduce /\n  .ForEach / .Any / .All / .CountIf` (since v0.3.6, takes a lambda)\n- Generic interfaces with static contract verification\n  (`class Box implements IComparable\u003cint\u003e`, since v0.3.5)\n\nDetailed reference: [docs/guide/](docs/guide/).\n\n## Diagnostics\n\nResolver and type-checker errors come with a source snippet and a\ncaret pointing at the offending token:\n\n```\nerror[typechecker]: Cannot assign 'string' to 'n' of type 'int'\n  --\u003e /tmp/test.am:19:13\n   |\n19 |         let n: int = p.Name\n   |             ^\n```\n\n```\nerror[resolver]: Unknown symbol 'someUndefinedThing'\n  --\u003e file.am:4:9\n   |\n 4 |         someUndefinedThing.x()\n   |         ^\n```\n\n## Tooling\n\n- **`amc fmt`** — formatter that re-emits a parsed AST canonically\n  while preserving comments. Idempotent on every source in this\n  repository. Run it as `amc fmt file.am` (stdout) or\n  `amc fmt -w file.am` (rewrite in place).\n- **`amc --lint file.am`** — static analysis: unreachable code,\n  unused locals (prefix `_` to silence), and shadowed names.\n  Warnings are non-fatal and don't bump the exit code.\n- **`amc test [\u003cdir\u003e]`** — discovers `*_test.am` under `\u003cdir\u003e`\n  (default `.`), compiles + runs each, and aggregates `[PASS]`,\n  `[FAIL]`, `[SKIP]` lines from their stdout. Each test file is a\n  normal Amalgame program with a `Main` that prints tag lines per\n  case; no framework required. Exits non-zero if any case FAILs\n  or any file fails to compile.\n- **`amc lsp`** — workspace-aware language server speaking JSON-RPC\n  2.0 on stdio. Publishes diagnostics on `didOpen` / `didChange`,\n  serves `textDocument/hover` (Markdown tooltip with the inferred\n  type) and `textDocument/completion` (every global symbol the\n  resolver knows about, including types declared in any sibling\n  `.am` file under the workspace root).\n- **`amc dap`** (v0.8.0+) — Debug Adapter Protocol proxy. Detects\n  a DAP-native backend on the host (`lldb-dap` from LLVM 18+,\n  `gdb --dap` from gdb 14+) and `execvp()`s into it. Combined\n  with `amc build -g` and the cgen's `#line` directives,\n  breakpoints set on `.am` source files resolve natively via\n  DWARF — no source-map files, no path translation. Works in\n  VS Code (the bundled extension declares the `amc` debug\n  type), Neovim, Helix, or any DAP-aware editor.\n- **`amc migrate \u003cfile|dir\u003e`** — LLM-assisted source-to-Amalgame\n  migration. Auto-detects 21 source languages by extension\n  (TS, Python, Java, C#, Go, Rust, …). Provider auto-selection from\n  env: `ANTHROPIC_API_KEY` → claude-api, `OPENAI_API_KEY` → chatgpt,\n  `GEMINI_API_KEY` → gemini, fallback `claude` (CLI). Directory\n  recursion, result cache by SHA-256 of source + system prompt,\n  cost estimation in `--dry-run`, automated `amc --check`\n  validation. See [`docs/guide/08-llm-commands.md`](docs/guide/08-llm-commands.md).\n- **`amc generate \"\u003cprompt\u003e\"`** — LLM-driven prose-to-Amalgame.\n  Same provider stack, plus `--stream` via the claude CLI for\n  direct stdout passthrough. Ideal for \"scaffold me a starting\n  point\".\n- **`amc explain \u003cfile.am\u003e`** — reverse direction: emit a\n  natural-language explanation of an Amalgame source file. Use\n  `--lang French` (or any other) to translate the explanation.\n- **VS Code syntax highlighting + LSP client** in [editors/vscode/](editors/vscode/).\n  Install with:\n  ```bash\n  ln -s \"$(pwd)/editors/vscode\" ~/.vscode/extensions/amalgame-0.2.0\n  ```\n\n## Project layout\n\n```\nsrc/                  Compiler, written in Amalgame\n├── lexer/              token.am, lexer.am\n├── parser/             ast.am, parser.am\n├── resolver/           symbol.am, resolver.am\n├── generator/          c_gen.am, gen_test.am\n├── formatter/          formatter.am\n├── linter.am           static analysis (amc --lint)\n├── typechecker.am\n├── diagnostics.am\n├── lsp.am              workspace-aware LSP server (amc lsp)\n├── migrate.am          LLM source-to-Amalgame (amc migrate)\n├── generate.am         LLM prose-to-Amalgame (amc generate)\n├── explain.am          LLM Amalgame-to-prose (amc explain)\n├── main.am             CLI: compile | fmt | test | lsp | migrate | generate | explain\n└── amc_lib.c           Self-hosted bundle (generated)\n\nruntime/              C runtime (bdwgc, strings, IO, collections, net, env, process)\nstdlib/               Stdlib API reference (.am declarations)\nsnapshot/             Tracked amc_lib.c known-good bootstrap\ntools/                save-snapshot.sh, release.sh\ntests/                Sample programs + run_*.sh runners\ndocs/guide/           User guide chapters 1–8\ndocs/proposals/       Design RFCs (amc-migrate.md tracks LLM roadmap)\neditors/vscode/       Syntax highlighting extension\n.github/workflows/    CI + tag-driven Release automation\n```\n\nThe build pipeline:\n\n```\nsrc/*.am ─[ ./amc ]─▶ amc_lib.c ─[ gcc ]─▶ amc binary\n              ▲                              │\n              └──────────────────────────────┘\n                  five-second self-rebuild\n```\n\nWhen `./amc` is missing or broken, `build_amc.sh` falls back to\n`./snapshot/amc`. From a clean clone, rebuild that binary with\n`gcc snapshot/amc_lib.c …` (see `snapshot/INFO.md`). See\n`tools/save-snapshot.sh` for capturing a new snapshot.\n\n## Roadmap\n\nThe full board is in [ROADMAP_COMPLET.md](ROADMAP_COMPLET.md). The\nshort version, ordered by unlocked-value per day of work:\n\n1. **Fix the SKIPped samples** — `Type.Variant` patterns in match,\n   `try / catch`, null-safety inference.\n2. **Minimal LSP** — completion + hover via stdio JSON-RPC, reusing\n   the existing parser, resolver, and type-checker.\n3. **Capturing closures.**\n4. **Generic type inference.**\n\n## Contributing\n\nWorkflow is a simplified gitflow:\n\n- `main` carries release tags only.\n- `develop` is the integration branch; PRs target it.\n- Features land via `feature/\u003cname\u003e` branches.\n\n```bash\ngit checkout develop\ngit checkout -b feature/my-thing\n# ...\n./build_amc.sh \u0026\u0026 ./tests/run_all_tests.sh\ngit push -u origin feature/my-thing\ngh pr create --base develop\n```\n\nCI runs on every push and pull request. Releases are produced by\npushing a `v*` tag — see `.github/workflows/release.yml`.\n\n## Privacy\n\nThe `amc` compiler runs entirely on the user's machine. It does not\nphone home, collect telemetry, log usage statistics, or transmit any\ndata to external servers. The only network operations are initiated\nexplicitly by the user:\n\n- `amc package add \u003cname\u003e` fetches a package + its index entry from\n  `github.com/amalgame-lang/packages-index` and the package's\n  upstream GitHub repository.\n- `amc package search` / `amc package versions` fetch the curated\n  index from the same source (cached locally for 30 min).\n- `amc migrate`, `amc generate`, `amc explain` are LLM-driven\n  helpers that send your source code (or natural-language prompt)\n  to a third-party AI provider that **you select via the\n  `--provider` flag and authenticate against with your own API\n  key**: Anthropic (Claude), OpenAI (ChatGPT), or Google (Gemini),\n  controlled by `ANTHROPIC_API_KEY` / `OPENAI_API_KEY` /\n  `GEMINI_API_KEY` environment variables. If none of these are\n  set, the commands fall back to invoking a locally-installed\n  `claude` CLI (which makes its own network calls under Anthropic's\n  terms). **Don't use these commands on confidential or NDA-bound\n  source code unless you have audited the chosen provider's data\n  retention and training-opt-out policy.** Amalgame itself never\n  routes the request through a server we control — it's a direct\n  HTTPS call from your machine to the provider.\n\nThe `amalgame.me` website serves static documentation and does not\nset tracking cookies. No personal data is collected by Amalgame as\na project.\n\n## License\n\n[Apache License 2.0](LICENSE) © Bastien Mouget\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famalgame-lang%2Famalgame","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famalgame-lang%2Famalgame","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famalgame-lang%2Famalgame/lists"}