{"id":45481666,"url":"https://github.com/quevivasbien/henrylang","last_synced_at":"2026-02-22T16:28:31.408Z","repository":{"id":233417526,"uuid":"776062848","full_name":"quevivasbien/henrylang","owner":"quevivasbien","description":"programming language for lobsters","archived":false,"fork":false,"pushed_at":"2024-05-22T16:14:59.000Z","size":354,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-05-22T17:34:32.428Z","etag":null,"topics":["functional-programming","hobby-project","programming-language","rust"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/quevivasbien.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2024-03-22T15:52:49.000Z","updated_at":"2024-06-04T03:33:07.292Z","dependencies_parsed_at":"2024-05-22T17:34:03.925Z","dependency_job_id":null,"html_url":"https://github.com/quevivasbien/henrylang","commit_stats":null,"previous_names":["quevivasbien/henrylang"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/quevivasbien/henrylang","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quevivasbien%2Fhenrylang","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quevivasbien%2Fhenrylang/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quevivasbien%2Fhenrylang/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quevivasbien%2Fhenrylang/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/quevivasbien","download_url":"https://codeload.github.com/quevivasbien/henrylang/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/quevivasbien%2Fhenrylang/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29718379,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-22T15:10:41.462Z","status":"ssl_error","status_checked_at":"2026-02-22T15:10:04.636Z","response_time":110,"last_error":"SSL_read: 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":["functional-programming","hobby-project","programming-language","rust"],"created_at":"2026-02-22T16:28:30.965Z","updated_at":"2026-02-22T16:28:31.399Z","avatar_url":"https://github.com/quevivasbien.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# henrylang\n\n`henrylang` is a programming language.\n\nThis repository includes both a bytecode interpreter and a web assembly compiler for henrylang. Both implementations are built from scratch.\n\n## How to run\n\nCompile with cargo:\n```bash\ncargo build --release\n```\n\nCompile \u0026 run:\n```bash\ncargo run --release\n```\n\nOr install on your machine:\n```bash\ncargo install --path .\n```\n\nThis will create an executable called `henrylang`. You can run that executable for an interactive interpreter session, or provide a file to run:\n```bash\nhenrylang \u003cscript_name\u003e\n```\n\n## Compilation to WASM\n\nIf you want to compile code to be run in a web environment, you can provide the `--save` flag. For example,\n```bash\nhenrylang script.hl --save\n```\nwill create a directory called `wasm_script` that contains 3 files: an `index.html`, `index.js`, and `module.wasm`. You can start a local server and open this in a web browser to see a simple example that loads and runs the web assembly module and displays the result.\n\nThere is also the option to run web assembly code using the Wasmer runtime. To allow this, you'll need to compile with the `wasmer` feature enabled: e.g.,\n```bash\ncargo build --release -F=wasmer\n```\nThen you can supply the `--wasm` flag to run scripts by compiling them to web assembly, then running it with the Wasmer runtime (instead of using the bytecode interpreter). For example:\n```bash\nhenrylang script.hl --wasm\n```\n\n\nAt this point, most of the current language features are implemented for the WASM compiler. The following is an overview of which features from the bytecode-compiled version of `henrylang` have been implemented, and which are still in-progress:\n\n#### Finished\n\n- Arithmetic\n- Variables\n- Basic functions\n- UTF-8 Strings\n- Arrays\n- User-defined types\n- Iterators (ranges, mapping, filtering, reduction)\n- Capturing functions (closures)\n- Builtin functions\n- Recursive functions\n\n#### To-do\n\n- Garbage collection\n\nNote that the bytecode interpreter uses 64 bit data types, while the WASM implementation uses 32 bit types.\n\n## Features\n\n- All variables are immutable.\n- Everything is an expression.\n- Functions are first-class.\n- Types are resolved at compile time.\n- Iterators are lazy.\n- Functions can be overloaded for different argument types.\n\n## Usage examples\n\n### Define a variable\n```\nx := \"hello\"\ny := 3.14159\n```\n\n### Define a function, then call it\n```\nf := |x: Int| {\n    x * x + 2\n}\n\nf(4)  ? 18\n```\n\n### Compute a sum in two different ways\n```\nmysum := |iter: Iter(Int)| {\n    reduce(|acc, x| { acc + x }, iter, 0)\n}\n\nmysum(0 to 10) = sum(0 to 10)  ? true\n```\n\n### Find prime numbers\n```\nis_prime := |n: Int| {\n    if n = 2 { true }\n    else {\n        sqrt_n := int(sqrt(float(n))) + 1\n        all(|p: Int| { mod(n, p) != 0 } -\u003e 2 to sqrt_n)\n    }\n}\n\n@filter(is_prime, 2 to 100)  ? [2, 3, 5, 7, ..., 97]\n```\n\n### Create a custom type\n```\nComplex := type { re: Float, im: Float }\n\nnorm := |x: Complex| {\n    sqrt(x.re * x.re + x.im * x.im)\n}\n\nx := Complex(1.0, -1.0)\nnorm(x)  ? 1.4142135\n```\n\n### Pass a function to a function\n```\nfunc_sum := |f: Func(Int, Int), g: Func(Int, Int), x: Int| {\n    f(x) + g(x)\n}\n\nfunc_sum(|x: Int|{ x + 1 }, |x: Int|{ x + 2 }, 1)  ? 5\n```\n\n### Overload a function\n```\npow := |a: Str, b: Int| {\n    reduce(|acc: Str, _: Int| { acc + a }, 1 to b, \"\")\n}\n\npow(\"Hi\", 3) = \"HiHiHi\" and pow(2, 3) = 8  ? true\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquevivasbien%2Fhenrylang","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fquevivasbien%2Fhenrylang","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fquevivasbien%2Fhenrylang/lists"}