{"id":45726098,"url":"https://github.com/hew-lang/hew","last_synced_at":"2026-05-06T11:02:37.199Z","repository":{"id":340088394,"uuid":"1164413590","full_name":"hew-lang/hew","owner":"hew-lang","description":"A statically-typed, actor-oriented programming language for concurrent and distributed systems.","archived":false,"fork":false,"pushed_at":"2026-05-05T16:40:14.000Z","size":11813,"stargazers_count":5,"open_issues_count":17,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-05T18:30:15.959Z","etag":null,"topics":["actor-model","actors","compiler","concurrency","hew","language","llvm","mlir","programming-language","rust"],"latest_commit_sha":null,"homepage":"https://hew.sh","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/hew-lang.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE-APACHE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":"NOTICE","maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-23T03:46:40.000Z","updated_at":"2026-05-05T16:40:17.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/hew-lang/hew","commit_stats":null,"previous_names":["hew-lang/hew"],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/hew-lang/hew","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hew-lang%2Fhew","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hew-lang%2Fhew/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hew-lang%2Fhew/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hew-lang%2Fhew/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hew-lang","download_url":"https://codeload.github.com/hew-lang/hew/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hew-lang%2Fhew/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32690536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-06T08:33:17.875Z","status":"ssl_error","status_checked_at":"2026-05-06T08:33:17.221Z","response_time":117,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["actor-model","actors","compiler","concurrency","hew","language","llvm","mlir","programming-language","rust"],"created_at":"2026-02-25T08:16:20.604Z","updated_at":"2026-05-06T11:02:37.194Z","avatar_url":"https://github.com/hew-lang.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Hew\n\nA statically-typed, actor-oriented programming language for concurrent and distributed systems.\n\n**[Website](https://hew.sh)** | **[Documentation](https://hew.sh/docs)** | **[Playground](https://hew.sh/playground)** | **[Tutorial](https://hew.sh/learn)**\n\n## Install\n\n```bash\ncurl -fsSL https://hew.sh/install.sh | bash\n```\n\nPre-built binaries for Linux (x86_64) and macOS (x86_64, ARM) are available on the [Releases](https://github.com/hew-lang/hew/releases) page. Also available via [Homebrew, Docker, and system packages](https://hew.sh/docs/install).\n\n## Quick Start\n\n```bash\n# Hello world\necho 'fn main() { println(\"Hello from Hew!\"); }' \u003e hello.hew\nhew run hello.hew\n\n# Start a new project\nhew init my_project\ncd my_project\n# hew init creates main.hew + README.md (no hew.toml)\nhew check main.hew\nhew fmt --check main.hew\nhew doc main.hew --output-dir doc\nhew run main.hew\n\n# Interactive REPL\nhew eval\n```\n\n### Evaluation \u0026 REPL\n\n`hew eval` can run as an interactive REPL, evaluate a file in REPL context, or\nevaluate a one-off inline expression. The REPL remembers top-level items and\n`let`/`var` bindings across inputs.\n\n```bash\nhew eval\nhew eval -f script.hew\nhew eval \"1 + 2\"\nhew eval --json -f script.hew\n```\n\nFor non-interactive runs, `-f -` reads from stdin and `--target wasm32-wasi`\nuses the WASI eval path.\n\nUse `:help` inside the REPL to see the command list. Common commands include\n`:help` / `:h`, `:session` / `:show`, `:items`, `:bindings`, `:type \u003cexpr\u003e`,\n`:load \u003cfile\u003e`, `:clear` / `:reset`, and `:quit` / `:q`.\n\n`hew init` is the source-only scaffold: it writes `main.hew` +\n`README.md`, but no `hew.toml`.\n\nSee the [Getting Started Guide](https://hew.sh/docs/getting-started) for more.\n\n### Learning Paths\n\nThe [`examples/`](examples/) directory contains structured learning paths for new users:\n\n- **[`examples/ux/`](examples/ux/)** — 15 quick-start lessons (hello world through hashmaps), each paired with an `.expected` output file; ideal for a first 20-minute tour\n- **[`examples/progressive/`](examples/progressive/)** — 11 numbered lessons building from variables to actors, also with `.expected` files\n- **[`examples/playground/`](examples/playground/)** — Topic-grouped snippets covering basics, concurrency, and types, with checked-in metadata in [`manifest.json`](examples/playground/manifest.json)\n\nSee [`examples/README.md`](examples/README.md) for the complete directory guide.\nIf you're looking specifically for multi-file/module layouts, start with\n[`examples/directory_module_demo/README.md`](examples/directory_module_demo/README.md)\nand then [`examples/multifile/README.md`](examples/multifile/README.md).\n\nWhen you move from language lessons to library APIs, use [`std/README.md`](std/README.md), the canonical index of shipped stdlib modules.\n\n### Language Basics\n\n**`println` and `print` are plain function calls, not macros.**  Coming from Rust, you might reach for `println!` — in Hew these are ordinary built-in functions written without a `!` suffix, auto-imported into every file:\n\n```hew\nfn main() {\n    print(\"hello \");     // no trailing newline\n    println(\"world\");    // appends newline\n    println(42);         // works with any type that implements Display\n}\n```\n\nTo use modules beyond the builtins, add an `import` statement at the top of your file:\n\n```hew\nimport std::fs;\nimport std::encoding::json;\n\nfn main() {\n    let data = fs.read(\"config.json\");\n    let obj = json.parse(data);\n    println(obj);\n}\n```\n\nSee [`std/README.md`](std/README.md) for the canonical index of shipped stdlib modules.\n\n### Multi-file programs \u0026 modules\n\nWhen you compile or typecheck a multi-file program with `hew check`,\n`hew build`, or `hew run`, pass one entry `.hew` file. Imports and\ndirectory-form modules pull in the rest, so pass `main.hew`, not every file in\nthe tree.\n\n`hew doc` is different: it accepts either one `.hew` file or a directory tree\nof `.hew` files to document.\n\n- `import foo;` prefers the directory-form module at `foo/foo.hew`, then falls\n  back to `foo.hew` beside the importer.\n- Other top-level `.hew` files inside `foo/` merge into the same module\n  automatically.\n- Child directories stay separate submodules, so import them explicitly — for\n  example `import foo::bar;`.\n- Start with\n  [`examples/directory_module_demo/README.md`](examples/directory_module_demo/README.md)\n  for the smallest working layout, then\n  [`examples/multifile/README.md`](examples/multifile/README.md) for selective\n  imports and nested module hierarchies.\n\n### Module search paths \u0026 stdlib discovery\n\nHew resolves imported modules in this order, and the first match wins:\n\n1. `HEWPATH` (colon-separated entries; each entry is the parent directory that\n   contains `std/`)\n2. `HEW_STD` (the path to the `std/` directory itself; Hew uses its parent as a\n   search root)\n3. The installed `\u003cprefix\u003e/share/hew` tree beside the `hew` binary\n4. A development fallback to the repo root when `std/` exists two levels above\n   the binary\n\n`hew.toml` does not configure module search paths. Use `HEWPATH` or `HEW_STD`\nwhen you need Hew to search a non-default stdlib or module root.\n\nTo browse shipped stdlib modules, generate docs for the stdlib tree:\n\n```bash\nhew doc std/ --output-dir doc/std\n```\n\nThis writes a browsable index page for the modules under `std/`. The canonical\nmodule list also lives in [`std/README.md`](std/README.md).\n\nFor the current wildcard-import warning caveat, see\n[`docs/troubleshooting.md`](docs/troubleshooting.md).\n\n### Wire Types\n\nWire types define versioned serialization schemas for use with actors and distributed protocols. Each field carries an explicit numeric tag (`@1`, `@2`, …) that is the field's stable identity across schema versions. You can safely add new tagged fields or rename existing ones; decoders that encounter an unknown tag skip it. **Never reuse a tag number for a different field.**\n\n```hew\nwire type UserMessage {\n    name: String @1;\n    age:  i32    @2;\n    // Adding a new @3 field later is backwards-compatible; reusing @1 is not.\n}\n```\n\nSee [`examples/playground/types/wire_types.hew`](examples/playground/types/wire_types.hew) for a runnable example.\n\n### Distributed Actors\n\nActors communicate across nodes with the same syntax used locally. The runtime handles transport, registry gossip, and remote dispatch transparently.\n\n```hew\n// server node\nNode::set_transport(\"quic\");\nNode::start(\"127.0.0.1:9000\");\nlet counter = spawn Counter;\nNode::register(\"counter\", counter);\n\n// client node (separate process)\nNode::set_transport(\"quic\");\nNode::start(\"127.0.0.1:9001\");\nNode::connect(\"127.0.0.1:9000\");\nlet counter: Counter = Node::lookup(\"counter\");\ncounter.increment(42);   // remote message — same syntax as local\n```\n\nSee [`examples/quic_mesh/`](examples/quic_mesh/) for a complete two-process QUIC mesh demo.\n\n## Architecture\n\nThe compiler has three layers: **Rust frontend** → **embedded MLIR middle layer** → **LLVM backend**.\n\n```\nsource.hew → Lexer → Parser → Type Checker → MessagePack Serialize\n               (hew-lexer) (hew-parser) (hew-types)    (hew-serialize)\n                                                              │\n                                         ▼ in-process C API\n               hew (Rust + C++):  hew_codegen_compile_msgpack\n                                         │\n                                         ▼\n                                  MLIRGen → Hew dialect → LLVM dialect → LLVM IR → .o\n               hew (Rust):        cc .o + libhew.a → executable\n```\n\n\u003e **Detailed diagrams:** See [`docs/diagrams.md`](docs/diagrams.md) for Mermaid sequence diagrams, state machines, and architecture visuals covering the full compilation pipeline, MLIR lowering stages, actor lifecycle, message flow, runtime layers, and wire protocol format.\n\n## Repository Structure\n\n### Compiler\n\n- **hew-cli/** — Compiler driver (`hew` binary)\n- **hew-lexer/** — Tokenizer\n- **hew-parser/** — Recursive-descent + Pratt precedence parser\n- **hew-types/** — Bidirectional type checker with Hindley-Milner inference; warnings carry source-module attribution so diagnostics in multi-module programs identify which module triggered each warning\n- **hew-serialize/** — MessagePack AST serialization\n- **hew-codegen/** — MLIR middle layer + LLVM backend (Hew dialect ops, lowering, code generation); built as a C++ library and **embedded inside the `hew` binary** — not a separately shipped executable\n- **hew-astgen/** — Generates C++ msgpack deserialization from AST definitions\n- **hew-runtime/** — Pure Rust actor runtime (`libhew_runtime.a`) with node mesh networking, QUIC transport, SWIM cluster membership, and cross-node actor registry; also compiles for WASM targets\n- **hew-cabi/** — C ABI bridge for stdlib FFI bindings\n\n### Package Manager \u0026 Tooling\n\n- **adze-cli/** — Package manager (`adze` binary) — init, install, publish, search\n- **hew-lsp/** — Language server (tower-lsp)\n- **hew-observe/** — Runtime observability TUI (`hew-observe`)\n- **hew-wasm/** — Analysis-only frontend compiled to WASM for in-browser diagnostics and editor tooling (not browser runtime/codegen/execution)\n\n### Standard Library \u0026 Build Support\n\n- **std/** — Standard library modules (`.hew` source files + Rust FFI crates)\n\n### Distribution\n\n- **editors/** — Editor support (Emacs, Nano, Sublime)\n- **installers/** — Package installers (Homebrew, Debian, RPM, Arch, Alpine, Nix, Docker) plus install-time shell completion generation\n- **examples/** — Example programs and benchmarks\n- **scripts/** — Development scripts\n- **docs/** — Language specification and API references\n\n## Documentation\n\nFull documentation at **[hew.sh/docs](https://hew.sh/docs)**\n\n- Local troubleshooting guide: [`docs/troubleshooting.md`](docs/troubleshooting.md)\n- Website source: **[github.com/hew-lang/hew.sh](https://github.com/hew-lang/hew.sh)**\n\n## Building from Source\n\n### Prerequisites\n\n| Dependency    | Version                 | Purpose                                     |\n| ------------- | ----------------------- | ------------------------------------------- |\n| Rust          | stable (latest)         | Frontend compiler, runtime, package manager |\n| LLVM          | 22.1                    | MLIR code generation and LLVM backend       |\n| MLIR          | (bundled with LLVM 22)  | Hew dialect and lowering passes             |\n| CMake         | \u003e= 3.20                 | Builds the embedded C++ MLIR backend        |\n| Ninja         | any                     | CMake build generator                       |\n| clang/clang++ | any (LLVM 22 preferred) | C/C++ compilation of the MLIR backend       |\n\n**Install on Ubuntu/Debian:**\n\n```bash\n# Rust\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n\n# LLVM 22 + MLIR\nsudo mkdir -p /etc/apt/keyrings\nwget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \\\n  | sudo tee /etc/apt/keyrings/llvm.asc \u003e/dev/null\necho \"deb [signed-by=/etc/apt/keyrings/llvm.asc] http://apt.llvm.org/noble/ llvm-toolchain-noble-22 main\" \\\n  | sudo tee /etc/apt/sources.list.d/llvm.list \u003e/dev/null\nsudo apt-get update\nsudo apt-get install -y cmake ninja-build \\\n  llvm-22-dev libmlir-22-dev mlir-22-tools clang-22\n```\n\n**Install on macOS:**\n\n```bash\n# Rust\ncurl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh\n\n# LLVM 22 + MLIR + build tools\nbrew install llvm ninja cmake\n```\n\n### Build\n\n```bash\nmake          # Build everything (debug)\nmake release  # Build everything (optimized)\nmake ci-preflight  # Dispatch a conservative local preflight from your current diff\nmake test     # Run Rust + native codegen tests\nmake lint     # cargo clippy\n```\n\nSee the [Makefile](Makefile) header for all targets.\n\nUse `make ci-preflight ARGS=\"--dry-run\"` to inspect the selected commands before\nrunning them. The first slice stays conservative: known docs/parser/types/CLI\ndiffs get narrower checks, and everything else falls back to broader local\npreflight commands.\n\n### Browser / Playground Validation\n\nThis repo does not build the downstream browser app or a full in-browser Hew\nruntime. The repo-local browser/playground slice here is analysis-only tooling:\n`hew-wasm` plus the curated\n[`examples/playground/manifest.json`](examples/playground/manifest.json)\nconsumed by downstream browser tooling.\n\n```bash\nmake playground-manifest        # regenerate examples/playground/manifest.json\nmake playground-manifest-check  # cheap freshness check for manifest.json only\nmake playground-check           # repo-local preflight: manifest freshness + curated analyze smoke + build hew-wasm\nmake playground-wasi-check      # focused manifest-driven WASI runtime preflight\n```\n\nUse `make playground-manifest-check` when you only need to confirm the checked-in manifest is current. Use `make playground-check` for the repo-local browser/tooling slice: curated `hew-wasm` analysis smoke plus the repo-local `hew-wasm` build (`make wasm`) that powers browser-side analysis tooling. Use `make playground-wasi-check` in codegen-capable environments when you also want the focused manifest-driven WASI runtime proof. Browser coverage remains analysis-only; this repo does not claim downstream browser execution exists.\n\n### Optional Dependencies\n\nThese are only needed for specific workflows:\n\n| Dependency           | Install                                             | Purpose                                        |\n| -------------------- | --------------------------------------------------- | ---------------------------------------------- |\n| wasmtime             | `curl https://wasmtime.dev/install.sh -sSf \\| bash` | Run WASM tests (`make test-wasm`)              |\n| wasm32-wasip1 target | `rustup target add wasm32-wasip1`                   | Build WASM runtime (`make wasm-runtime`)       |\n| wasm-pack            | `cargo install wasm-pack`                           | Build browser analysis bindings (`make wasm`, `make playground-check`) |\n| Python 3             | system package manager                              | Playground manifest + other scripts (`scripts/`) |\n| Java 21 + ANTLR4     | system package manager                              | Grammar validation (`make grammar`)            |\n| cargo-fuzz           | `cargo install cargo-fuzz`                          | Parser fuzzing (`hew-parser/fuzz/`)            |\n\n## License\n\nHew is distributed under the terms of both the MIT license and the Apache License (Version 2.0).\n\nSee [LICENSE-MIT](LICENSE-MIT) and [LICENSE-APACHE](LICENSE-APACHE) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhew-lang%2Fhew","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhew-lang%2Fhew","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhew-lang%2Fhew/lists"}