{"id":51397416,"url":"https://github.com/desertthunder/regulus","last_synced_at":"2026-07-04T03:34:23.689Z","repository":{"id":364232744,"uuid":"1258388281","full_name":"desertthunder/regulus","owner":"desertthunder","description":"a gleam to wasm compiler","archived":false,"fork":false,"pushed_at":"2026-06-19T20:12:16.000Z","size":3162,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-06-19T22:08:14.573Z","etag":null,"topics":["compiler","functional-programming","gleam","rust","systems-programming","wasm","webassembly"],"latest_commit_sha":null,"homepage":"https://reggie.desertthunder.dev","language":"Rust","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/desertthunder.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-06-03T14:30:16.000Z","updated_at":"2026-06-19T20:12:20.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/desertthunder/regulus","commit_stats":null,"previous_names":["desertthunder/regulus"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/desertthunder/regulus","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desertthunder%2Fregulus","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desertthunder%2Fregulus/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desertthunder%2Fregulus/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desertthunder%2Fregulus/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/desertthunder","download_url":"https://codeload.github.com/desertthunder/regulus/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/desertthunder%2Fregulus/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35109210,"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-07-04T02:00:05.987Z","response_time":113,"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":["compiler","functional-programming","gleam","rust","systems-programming","wasm","webassembly"],"created_at":"2026-07-04T03:34:23.023Z","updated_at":"2026-07-04T03:34:23.684Z","avatar_url":"https://github.com/desertthunder.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Regulus\n\nRegulus (\"Reggie\") is an experimental Gleam to WebAssembly compiler written in\nRust.\n\n\u003cimg src=\"./docs/book/src/favicon.png\" alt=\"Reggie\" width=\"196\"/\u003e\n\nThe compiler uses tree-sitter to parse Gleam source, builds compiler-owned data\nstructures, lowers a supported subset of Gleam to core IR, and emits `.wasm`\nwith optional WAT output.\n\n```text\nGleam source\n  -\u003e tree-sitter syntax tree\n  -\u003e AST\n  -\u003e name resolution\n  -\u003e type checking\n  -\u003e core IR\n  -\u003e WebAssembly module\n  -\u003e .wasm / optional WAT\n```\n\n## Status\n\nRegulus is not a full Gleam compiler yet. It can compile and run small programs\nusing scalar values, managed values, pattern matching, closures, selected stdlib\nmodules, and host imports. The compiler pipeline is intentionally visible so\nthat each layer can be tested and explained.\n\n### At a glance\n\n| Area                          | Status                          |\n| ----------------------------- | ------------------------------- |\n| Single-file Gleam to Wasm     | Supported                       |\n| Type checking                 | Broad subset                    |\n| Managed runtime values        | Partial                         |\n| Standard library              | Selected modules and intrinsics |\n| Whole-project linked output   | Supported subset                |\n| Dependency source loading     | Selected Hex and path packages  |\n| Browser, bundler, and Node.js | Supported adapter subset        |\n| WASI ABI                      | Incomplete                      |\n\n### Working today\n\n- [x] Parse Gleam source with tree-sitter\n- [x] Build an AST with source spans\n- [x] Report diagnostics with source spans\n- [x] Resolve imports, modules, locals, types, constructors, and fields\n- [x] Type check scalar values, structured values, calls, branches, and patterns\n- [x] Infer generic functions, generic constructors, closures, and list types\n- [x] Lower the supported subset to core IR\n- [x] Emit deterministic `.wasm`\n- [x] Render optional WAT\n- [x] Run scalar and managed-value exports with Wasmtime\n- [x] Load `gleam.toml` and discover project modules\n- [x] Compile supported projects into linked Wasm output\n- [x] Load selected Hex and path dependency sources\n- [x] Lower supported externals to Wasm imports\n- [x] Validate target-aware host imports\n- [x] Emit deterministic browser, bundler, and Node.js `.mjs` adapters\n- [x] Emit optional AST, resolved, typed, IR, runtime, and ABI debug artifacts\n- [x] Render source diagnostics with snippets, labels, notes, and stable\n      project ordering\n- [x] Keep normal CLI output concise, with `--no-color` and `NO_COLOR` support\n\n### Supported Gleam surface\n\n- [x] Public and private functions\n- [x] Function annotations and inferred parameters\n- [x] `Int`, `Float`, `Bool`, `String`, and `Nil`\n- [x] Local bindings and structured patterns\n- [x] Direct, imported, and external calls\n- [x] `case` expressions, guards, and nested patterns\n- [x] Type aliases, custom types, opaque types, generics, and constructors\n- [x] Records, custom values, tuples, lists, and bit arrays\n- [x] Anonymous functions, captures, closures, pipelines, and `use`\n- [x] Selected stdlib modules and intrinsics\n\n### WebAssembly output\n\n- [x] Function definitions, imports, and exports\n- [x] Scalar ABI values: `i64`, `f64`, and `i32`\n- [x] Managed values as guest-memory pointers\n- [x] Linear memory and static data segments\n- [x] Runtime objects for strings, records, lists, tuples, closures, and custom\n      values\n- [x] Branches, comparisons, equality, pattern checks, and failure paths\n- [x] Selected runtime helpers and stdlib intrinsics\n- [x] Checked runtime helper fragments before final module output\n\n### Not yet implemented\n\n- [ ] Compile every valid Gleam project shape\n- [ ] Compile broad dependency source modules without subset limits\n- [ ] Compile the full published `gleam_stdlib` package without registry shims\n- [ ] Provide complete browser, bundler, and Node.js host APIs beyond the\n      current adapter subset\n- [ ] Provide complete WASI adapters\n- [ ] Add garbage collection or reference counting for long-lived managed\n      values\n\nFor more detail, see the case-study book in\n[docs/book](./docs/book/src/introduction.md) and the user/development docs in\n[docs/website](./docs/website/index.md).\n\n## Usage\n\nBuild a Gleam project into one linked Wasm artifact:\n\n```sh\ncargo run -q -p compiler_cli -- build examples/scalar_project\n```\n\nCompile a single Gleam source file:\n\n```sh\ncargo run -q -p compiler_cli -- compile fixtures/e2e/public_id.gleam \\\n  -o .sandbox/public_id.wasm \\\n  --emit wasm,wat \\\n  --dump-dir .sandbox/dumps\n```\n\n`--emit` selects artifacts such as `wasm`, `wat`, `ast`, `resolved`, `typed`,\nand `ir`. The `--dump-dir` flag writes debug output for compiler stages. See\n[CLI usage](./docs/website/guide/usage/cli.md) for project builds, targets,\nartifacts, and `run`.\n\n## Development\n\nUse the Rust workspace from the repository root:\n\n```sh\ncargo fmt\ncargo test\ncargo clippy --workspace --all-targets\n```\n\nTo run examples \u0026 tests:\n\n```sh\ncargo test -p compiler_core\ncargo test -p compiler_cli\n```\n\n```sh\ncargo run -q -p compiler_cli -- compile fixtures/e2e/public_id.gleam \\\n  --out-dir .sandbox --emit wasm,wat\ncargo run -q -p compiler_cli -- run fixtures/e2e/public_id.gleam\ncargo run -q -p compiler_cli -- build examples/scalar_project \\\n  --target bundler --out-dir .sandbox\n```\n\n### Documentation\n\n```sh\ncd docs/website\npnpm install\npnpm docs:dev\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesertthunder%2Fregulus","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdesertthunder%2Fregulus","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdesertthunder%2Fregulus/lists"}