{"id":13749276,"url":"https://github.com/ljedrz/blc","last_synced_at":"2025-08-08T10:37:38.185Z","repository":{"id":57517072,"uuid":"87540386","full_name":"ljedrz/blc","owner":"ljedrz","description":"Binary lambda calculus","archived":false,"fork":false,"pushed_at":"2018-01-29T14:13:40.000Z","size":65,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-19T21:20:47.800Z","etag":null,"topics":["binaryformat","encoding","lambda-calculus","rust-library"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ljedrz.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}},"created_at":"2017-04-07T11:48:33.000Z","updated_at":"2025-02-27T13:06:18.000Z","dependencies_parsed_at":"2022-09-15T21:23:26.185Z","dependency_job_id":null,"html_url":"https://github.com/ljedrz/blc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ljedrz/blc","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fblc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fblc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fblc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fblc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ljedrz","download_url":"https://codeload.github.com/ljedrz/blc/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ljedrz%2Fblc/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269409441,"owners_count":24412140,"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-08-08T02:00:09.200Z","response_time":72,"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":["binaryformat","encoding","lambda-calculus","rust-library"],"created_at":"2024-08-03T07:00:58.300Z","updated_at":"2025-08-08T10:37:38.144Z","avatar_url":"https://github.com/ljedrz.png","language":"Rust","readme":"# blc\n\n**blc** is an implementation of the\n[binary lambda calculus](https://esolangs.org/wiki/Binary_lambda_calculus).\n\n## Binary lambda calculus basics\n\nBinary lambda calculus (BLC) is a minimal, purely functional programming language based on a binary\nencoding of the untyped [lambda calculus](https://en.wikipedia.org/wiki/Lambda_calculus) with\n[De Bruijn indices](https://en.wikipedia.org/wiki/De_Bruijn_index).\n\nLambda terms have the following representation in BLC:\n\n| term        | lambda | BLC            |\n--------------|--------|----------------|\n| abstraction | λM     | 00M            |\n| application | MN     | 01MN           |\n| variable    | i      | 1\u003csup\u003ei\u003c/sup\u003e0 |\n\nSince BLC programs are basically lambda calculus terms, they can be applied to other terms. In\norder for them to be applicable to binary (but not BLC-encoded) input, it has to be lambda-encoded\nfirst. Bytestrings are lambda-encoded as\n[single-pair lists](https://en.wikipedia.org/wiki/Church_encoding#One_pair_as_a_list_node) of bytes\nand bytes are lambda-encoded as single-pair lists of lambda-encoded bits.\n\nBits 0 and 1 are lambda-encoded as\n[Church booleans](https://en.wikipedia.org/wiki/Church_encoding#Church_Booleans):\n\n| bit | lambda      | BLC     |\n|-----|-------------|---------|\n|  0  | λλ2 (true)  | 0000110 |\n|  1  | λλ1 (false) | 000010  |\n\nExample: BLC-encoding steps for a byte representing the ASCII/UTF-8 encoded letter 'a':\n\n| encoding  | representation |\n|-----------|----------------|\n| decimal   | 96             |\n| binary    | 01100001       |\n| lambda    | λ1(\u003cb\u003eλλ2\u003c/b\u003e)(λ1(\u003cb\u003eλλ1\u003c/b\u003e)(λ1(\u003cb\u003eλλ1\u003c/b\u003e)(λ1(\u003cb\u003eλλ2\u003c/b\u003e)(λ1(\u003cb\u003eλλ2\u003c/b\u003e)(λ1(\u003cb\u003eλλ2\u003c/b\u003e)(λ1(\u003cb\u003eλλ2\u003c/b\u003e)(λ1(\u003cb\u003eλλ1\u003c/b\u003e)(λλ1)))))))) |\n| BLC (hex) | 16 16 0c 2c 10 b0 42 c1 85 83 0b 06 16 0c 2c 10 41 00 |\n\n## [Documentation](https://docs.rs/blc)\n\n## Example BLC program\n\n```\nextern crate blc;\nextern crate lambda_calculus;\n\nuse blc::*;\nuse blc::encoding::binary::to_bits;\nuse blc::execution::Input;\nuse lambda_calculus::{parse, DeBruijn};\n\nfn repeat(input: \u0026[u8]) -\u003e String {\n    let code_lambda = \"λ1((λ11)(λλλλλ14(3(55)2)))1\"; // the program (a lambda expression)\n    let code_term   = parse(code_lambda, DeBruijn).unwrap();\n    let code_blc    = to_bits(\u0026code_term); // the program in binary lambda calculus\n\n    run(\u0026*code_blc, Input::Bytes(input)).unwrap()\n}\n\nfn main() {\n    assert_eq!(\n        repeat(\u0026*b\"hurr\"),\n        \"hurrhurr\"\n    );\n}\n```\n","funding_links":[],"categories":["Lambda Calculus"],"sub_categories":["Libraries"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljedrz%2Fblc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fljedrz%2Fblc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fljedrz%2Fblc/lists"}