{"id":26190308,"url":"https://github.com/uben0/leam","last_synced_at":"2026-04-26T02:31:59.266Z","repository":{"id":280882101,"uuid":"942637198","full_name":"uben0/leam","owner":"uben0","description":"A Statically Typed, Functional Programming Language","archived":false,"fork":false,"pushed_at":"2025-03-18T15:25:14.000Z","size":36,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-18T16:36:35.624Z","etag":null,"topics":[],"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/uben0.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":"2025-03-04T12:28:53.000Z","updated_at":"2025-03-18T15:25:17.000Z","dependencies_parsed_at":"2025-03-05T20:48:50.331Z","dependency_job_id":"6a27db4e-8d26-40f1-bd60-ae4ee73d002f","html_url":"https://github.com/uben0/leam","commit_stats":null,"previous_names":["uben0/leam"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/uben0/leam","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uben0%2Fleam","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uben0%2Fleam/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uben0%2Fleam/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uben0%2Fleam/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uben0","download_url":"https://codeload.github.com/uben0/leam/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uben0%2Fleam/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28017145,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-12-25T02:00:05.988Z","response_time":58,"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":[],"created_at":"2025-03-12T00:53:23.006Z","updated_at":"2025-12-25T02:11:45.999Z","avatar_url":"https://github.com/uben0.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LEAM\n\nA statically typed, functional programming language inspired by the Gleam lanugage. I am basically trying to re-implement its compiler to target binaries instead of Erlang or Javascript.\n\n```gleam\ntype List(a) {\n  Node(a, List(a))\n  Leaf()\n}\n\nfn main() {\n  let list = Node(4, Node(0, Leaf()))\n  print_list(list)\n}\n\nfn print_list(list: List(a)) {\n  case list {\n    Node(elem, tail) -\u003e {\n      write elem\n      print_list(tail)\n    }\n    Leaf() -\u003e {}\n  }\n}\n```\n\nSome logs during compilation gives good insights on what is happening:\n\n```\nexporting main[] at index 0\ninferring poly params\n  - poly type fn('0, List('0)) -\u003e List('0)\n  - usage type fn(Int, List(Int)) -\u003e List(Int)\nexporting Node[Int32] at index 1\ninferring poly params\n  - poly type fn('0, List('0)) -\u003e List('0)\n  - usage type fn(Int, List(Int)) -\u003e List(Int)\ninferring poly params\n  - poly type fn() -\u003e List('0)\n  - usage type fn() -\u003e List(Int)\nexporting Leaf[Int32] at index 2\ninferring poly params\n  - poly type fn(List('0)) -\u003e Nil\n  - usage type fn(List(Int)) -\u003e Nil\nexporting print_list[Int32] at index 3\ninferring poly params\n  - poly type fn(List('0)) -\u003e Nil\n  - usage type fn(List('0)) -\u003e Nil\n```\n\n## Backend\n\nThe backend is a low level representation of the program.\n\nA module contains functions. A function is identified by its index (position in the list).\n\nThe following data types are available:\n- [x] `i32`\n- [x] `u32`\n- [x] `f32`\n- [x] `unit` the void value\n- [x] `fn` a function index\n- [x] `block` an opaque value\n    - [ ] will have a size\n    - [ ] and an alignment\n\nThe following instructions are available:\n- [x] `const` provides a hard written value\n- [x] `assign` and `read` assigns then reads a value to and from a memory cell\n    - [x] functions take an arbitrary list of parameters assigned to memory cells\n    - [ ] a `write` instruction mutates the stored value (will add a flag to `assign`, either `static` or `volatile` to disallow or allow mutation)\n- [x] `call` invokes a function with the provided parameters\n- [x] `input` and `output` reads and writes value to stdin and stdout\n- [x] `add`, `sub`, `mul`, `div` and `eq` are the usual binary operators\n- [x] `and` and `or` are the boolean operators with arbitrary number of operands, currently they are lazy and will shortcircuit\n    - [ ] add a flag to control wether to be lazy or greedy\n- [x] `branch` is currently the only control flow available\n    - execute the first branch with a positive predicate\n    - has a last default branch in case non of the above were positive\n- [x] `panic` does what it says\n\nThe above code compiles to:\n\n```scheme\n(module\n    (fn unit\n        (assign block 0\n            (call\n                (const fn 1)\n                (const i32 +4)\n                (call\n                    (const fn 1)\n                    (const i32 +0)\n                    (call\n                        (const fn 2))))\n            (call\n                (const fn 3)\n                (read block 0))))\n    (fn block i32 0 block 1\n        (group\n            (const u32 0)\n            (read i32 0)\n            (read block 1)))\n    (fn block\n        (group\n            (const u32 1)))\n    (fn unit block 0\n        (branch unit\n            (eq u32\n                (const u32 0)\n                (extract u32 0\n                    (read block 0)))\n            (do\n                (output i32\n                    (extract i32 1\n                        (read block 0)))\n                (call\n                    (const fn 3)\n                    (extract block 2\n                        (read block 0))))\n            (eq u32\n                (const u32 1)\n                (extract u32 0\n                    (read block 0)))\n            (const unit)\n            (panic))))\n```\n\n# ROADMAP\n\n- frontend\n  - [ ] polymorphic let\n  - [ ] embeded polymorphism\n  - [ ] lifetime and reference counting\n  - [ ] determine size of types\n  - [ ] extend builtin types\n    - [ ] list\n    - [ ] string\n\n- backend\n  - [ ] alloc, ptr, free\n  - [ ] block sized\n  - [ ] emit LLVM IR\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuben0%2Fleam","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuben0%2Fleam","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuben0%2Fleam/lists"}