{"id":28457509,"url":"https://github.com/sdingcn/clo","last_synced_at":"2025-06-30T03:31:12.070Z","repository":{"id":169181283,"uuid":"645083834","full_name":"sdingcn/clo","owner":"sdingcn","description":"a Lisp-like functional language with flexible suspension and resumption","archived":false,"fork":false,"pushed_at":"2025-06-29T13:21:01.000Z","size":456,"stargazers_count":15,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-29T14:27:27.079Z","etag":null,"topics":["compiler","continuation","coroutine","functional-programming","garbage-collection","interpreter","programming-language","quine","runtime"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdingcn.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,"zenodo":null}},"created_at":"2023-05-24T22:21:06.000Z","updated_at":"2025-06-29T13:21:04.000Z","dependencies_parsed_at":"2023-12-19T06:30:58.383Z","dependency_job_id":"3257cb40-ffc7-4742-a5ec-0fa39109fbb1","html_url":"https://github.com/sdingcn/clo","commit_stats":null,"previous_names":["sdingcn/expr","sdingcn/closure","sdingcn/cvm","sdingcn/cvm.experimental","sdingcn/clocalc","sdingcn/clo"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/sdingcn/clo","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdingcn%2Fclo","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdingcn%2Fclo/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdingcn%2Fclo/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdingcn%2Fclo/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdingcn","download_url":"https://codeload.github.com/sdingcn/clo/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdingcn%2Fclo/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262703996,"owners_count":23350968,"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","continuation","coroutine","functional-programming","garbage-collection","interpreter","programming-language","quine","runtime"],"created_at":"2025-06-06T23:40:07.934Z","updated_at":"2025-06-30T03:31:12.046Z","avatar_url":"https://github.com/sdingcn.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# clo\n\n![](https://github.com/sdingcn/clo/actions/workflows/CI.yml/badge.svg)\n[![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/sdingcn/clo)\n\n**Clo** is a small, dynamically-typed, garbage-collected, functional programming language.\nHere is its syntax.\n```\n\u003ccomment\u003e   := \"#\" [^\\n]* \"\\n\"\n\u003cintrinsic\u003e := \".\" [^\\s]+\n\u003cbinding\u003e   := \u003cvar\u003e \u003cexpr\u003e\n\u003cexpr\u003e      := \u003cint-literal\u003e | \u003cstr-literal\u003e | \u003cvar\u003e\n            |  lambda ( \u003cvar\u003e* ) \u003cexpr\u003e\n            |  letrec ( \u003cbinding\u003e* ) \u003cexpr\u003e\n            |  if \u003cexpr\u003e \u003cexpr\u003e \u003cexpr\u003e\n            |  { \u003cexpr\u003e+ }  // sequenced evaluation\n            |  ( \u003cintrinsic\u003e \u003cexpr\u003e* )\n            |  ( \u003cexpr\u003e \u003cexpr\u003e* )\n            |  @ \u003cvar\u003e \u003cexpr\u003e  // access var in closure's env (can simulate structs)\n```\n\nThe distinguished feature of clo is serializing\nthe current program state as a string.\nThe built-in function `.forkstate` returns\na string encoding the program state,\nand when the state is resumed using `.eval` it starts\nright after the `.forkstate` call but with a return value of Void type.\nThis resembles Linux's `fork`, Lisp's `call/cc`, etc.\nFor example, the following program outputs 0, 1, 2, 2, 3 in order.\nNote: `.eval` works on both source code and serialized program state.\n```\n{\n    (.putstr \"0\\n\")\n    (.putstr \"1\\n\")\n    letrec (state (.forkstate)) {\n        (.putstr \"2\\n\")\n        if (.= (.type state) 0)  # if it is a void value\n           (.putstr \"3\\n\")\n           (.eval state)\n    }\n}\n```\n\nSee [test/](test/) for more code examples (`*.clo`).\n\n## dependencies\n\nThe source code of the interpreter\nis standard C++20 and thus can be compiled\nby any C++20-conforming compiler.\nThe current `Makefile` and `CI.py`\nneed `clang++` (with C++20 support), `make`, and `python3`.\n\n## build and run\n\n```\nmake -C src/ release\nbin/clo \u003csource-path\u003e\n```\n\n`python3 CI.py` (re-)builds the interpreter and runs all tests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdingcn%2Fclo","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdingcn%2Fclo","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdingcn%2Fclo/lists"}