{"id":16633064,"url":"https://github.com/yazaldefilimone/lemon","last_synced_at":"2025-04-14T22:27:09.202Z","repository":{"id":278010684,"uuid":"844508194","full_name":"yazaldefilimone/lemon","owner":"yazaldefilimone","description":"an experimental, modern, purely safe, programming language.","archived":false,"fork":false,"pushed_at":"2025-04-10T11:43:10.000Z","size":765,"stargazers_count":6,"open_issues_count":13,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-10T12:55:05.152Z","etag":null,"topics":["compiler","programming-language","rust"],"latest_commit_sha":null,"homepage":"https://lemonlang.org","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/yazaldefilimone.png","metadata":{"files":{"readme":"readme.md","changelog":null,"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}},"created_at":"2024-08-19T12:04:59.000Z","updated_at":"2025-03-25T14:14:35.000Z","dependencies_parsed_at":null,"dependency_job_id":"034f6930-7989-4468-9ede-66194be45d00","html_url":"https://github.com/yazaldefilimone/lemon","commit_stats":null,"previous_names":["yazaldefilimone/lemon"],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yazaldefilimone%2Flemon","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yazaldefilimone%2Flemon/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yazaldefilimone%2Flemon/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yazaldefilimone%2Flemon/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yazaldefilimone","download_url":"https://codeload.github.com/yazaldefilimone/lemon/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248225652,"owners_count":21068078,"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","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","programming-language","rust"],"created_at":"2024-10-12T05:11:52.020Z","updated_at":"2025-04-14T22:27:09.195Z","avatar_url":"https://github.com/yazaldefilimone.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!--\n\n```rs\nlet std = import(\"std\");\nlet fmt = import(\"fmt\");\nlet http = import(\"http\");\n\nlet server = http::server();\n\nserver::route(\"/hello/:name\", fn(params) = {\n  fn(request, response) = {\n    params::method |\u003e match {\n      \"GET\" =\u003e fmt::format(\"Hello, {}!\", params::name),\n      _     =\u003e \"Method not allowed\"\n    } |\u003e response::send;\n  }\n});\n\nserver::start(3003);\n```\n\n```rs\nlet std = import(\"std\");\nlet fmt = import(\"fmt\");\nlet http = import(\"http\");\n\nlet server = http::server();\n\nserver::route(\"/hello/:name\", fn({ params, query }) = {\n  let greeting = query::get(\"greeting\")::unwrap_or(\"\");\n  fn(request, response) = {\n    params::method |\u003e match _ {\n      \"GET\" =\u003e {\n        let message = fmt::format(\"{} {}!\", greeting, params::name);\n        message |\u003e response::send;\n      },\n      _ =\u003e response::send(\"Method not allowed\"),\n    }\n  }\n});\n\nserver::start(3003);\n```\n\n#### Lemon IR\n\n- lemon\n\n```rs\nfn compute(a: u32, b: u32): u32 = {\n  let mut sum = a + b;\n  if sum \u003e 100 {\n    let diff = sum - 50;\n    return diff;\n  }\n  sum\n}\n\nfn main(): u32 = {\n  let x = 42;\n  let y = 58;\n  let result = compute(x, y);\n  result\n}\n```\n\n- ir\n\n```rs\nfn compute r0: u32, r1: u32 -\u003e u32\nl0: add r0, r1 -\u003e r2\nl1: cmp_gt r2, 100 -\u003e r3\n    jmp_if r3, l2, l3\nl2: sub r2, 50 -\u003e r4\n    free r2\n    ret r4\nl3: ret r2\n\nfn main -\u003e u32\nl0: own 42 -\u003e r0\n    own 58 -\u003e r1\n    call compute r0, r1 -\u003e r2\n    free r0\n    free r1\n    ret r2\n```\n\n- optimizer steps\n\n1. remove unused variables\n\n```rs\nfn compute r0: u32, r1: u32 -\u003e u32\nl0: add r0, r1 -\u003e r2\nl1: cmp_gt r2, 100 -\u003e r3\n    jmp_if r3, l2, l3\nl2: sub r2, 50 -\u003e r4\n    ret r4\nl3: ret r2\n\nfn main -\u003e u32\nl0: own 42 -\u003e r0\n    own 58 -\u003e r1\n    call compute r0, r1 -\u003e r2\n    free r0\n    free r1\n    ret r2\n\n```\n\n2. constant propagation\n\n```rs\nfn main -\u003e u32\nl0: add 42, 58 -\u003e r0 # inline compute directly in main\nl1: cmp_gt r0, 100 -\u003e r1\n    jmp_if r1, l2, l3\nl2: sub r0, 50 -\u003e r2\n    ret r2\nl3: ret r0\n\n```\n\n3. dead block elimination\n\n```rs\nfn main -\u003e u32\nl0: add 42, 58 -\u003e r0 # constant propagation simplifies flow\nl1: sub r0, 50 -\u003e r1\n    ret r1\n\n```\n\n4. fn inlining\n\n```rs\nfn main -\u003e u32\nl0: add 42, 58 -\u003e r0 # compute body is directly inlined\nl1: sub r0, 50 -\u003e r1\n    ret r1\n\n```\n\n5. constant folding\n\n```rs\nfn main -\u003e u32\nl0: own 50 -\u003e r0 # compute constant values at compile time\n    ret r0\n\n\n```\n\n- compiler\n\n1. llvm\n2. wasm\n3. lemon runtime (dev mode)\n\n--\u003e\n##### WIP\nThis is highly in progress, so it's accepted and even expected that at any point the main branch may be broken.\n\n#### Versioning strategy\n\n- Start at **0.0.1** and increment the last number for each new feature (e.g., `0.0.2` for adding enums).  \n- Increase the middle number (e.g., `0.1.0`) after reaching a stable milestone with multiple improvements.  \n- When the language is stable and production-ready, move to **1.0.0**.  \n- Use Git tags like `v0.0.1`, `v0.1.0`, and maintain a changelog for tracking updates.  \n- No rush for version 1.0 – focus on steady growth and reliability.  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyazaldefilimone%2Flemon","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyazaldefilimone%2Flemon","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyazaldefilimone%2Flemon/lists"}