{"id":13780056,"url":"https://github.com/tvcutsem/schemeken","last_synced_at":"2026-02-21T02:33:57.507Z","repository":{"id":4169826,"uuid":"5285542","full_name":"tvcutsem/schemeken","owner":"tvcutsem","description":"A Distributed Resilient Scheme Interpreter","archived":false,"fork":false,"pushed_at":"2013-07-09T19:34:10.000Z","size":334,"stargazers_count":15,"open_issues_count":0,"forks_count":4,"subscribers_count":8,"default_branch":"master","last_synced_at":"2024-08-03T18:14:42.380Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tvcutsem.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":"2012-08-03T13:16:40.000Z","updated_at":"2024-02-19T21:41:21.000Z","dependencies_parsed_at":"2022-08-29T21:01:01.258Z","dependency_job_id":null,"html_url":"https://github.com/tvcutsem/schemeken","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvcutsem%2Fschemeken","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvcutsem%2Fschemeken/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvcutsem%2Fschemeken/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tvcutsem%2Fschemeken/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tvcutsem","download_url":"https://codeload.github.com/tvcutsem/schemeken/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225056762,"owners_count":17414204,"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":[],"created_at":"2024-08-03T18:01:11.912Z","updated_at":"2026-02-21T02:33:57.451Z","avatar_url":"https://github.com/tvcutsem.png","language":"C","funding_links":[],"categories":["C"],"sub_categories":[],"readme":"schemeken\n=========\n\nA Distributed Resilient Scheme Interpreter\n\nRoots\n=====\n\nSchemeken is the marriage of:\n\n  * [Ken](http://ai.eecs.umich.edu/~tpkelly/Ken/), a platform for fault-Tolerant distributed computing.\n  * Slip, a Scheme interpreter developed by Prof. Theo D'Hondt. It is a lean interpreter written in C to teach students the basics of language interpreters and virtual machines in a course on [Programming Language Engineering](http://soft.vub.ac.be/~tjdhondt/PLE).\n\nGetting Started\n===============\n\nSchemeken can be compiled using GNU Make and a C compiler:\n\n````console\n$ git clone https://github.com/tvcutsem/schemeken.git\n$ cd schemeken\n$ make\n````\n\nIf all goes well, a binary called `schemeken` will be generated.\nYou need to supply an IP:port combination for the Ken subsystem to work, which will drop you into a functional REPL:\n\n````console\n$ ./schemeken 127.0.0.1:6789\n...\n35515:Ken/ken.c:982: handler process main loop starting\nInitializing...\n\n\u003e\u003e\u003e\n````\n\nYou can define new variables and functions in this REPL and they will be persisted across runs.\nLet's try that now:\n\n````console\n\u003e\u003e\u003e (define (fac n) (if (\u003c n 2) 1 (* n (fac (- n 1)))))\n\u003cprocedure fac\u003e\n\u003e\u003e\u003e (fac 5)\n120\n````\n\nIf you now kill this interpreter using Ctrl-C and start it again: (make sure to give the same IP/port combination!)\n\n````console\n$ ./schemeken 127.0.0.1:6789\n...\n35534:Ken/ken.c:968: recovering from turn 2\n...\n\u003chit enter\u003e\n\nRestoring state ...\nWelcome back!\n\n\u003e\u003e\u003e (fac 5)\n120\n````\n\nKen makes sure that all heap state is persisted across crashes. In addition, all code evaluated in a single read-eval-print loop session (or in response to an incoming remote message) is treated as an atomic transaction: either all side-effects are persisted, or none are. If the interpreter crashes in the middle of evaluating an expression, it will be restored with the last consistent state before crashing. For example:\n\n````console\n\u003e\u003e\u003e (define x 42)\n42\n\u003e\u003e\u003e(define (loop-forever) (loop-forever))\n\u003cprocedure loop-forever\u003e\n\u003e\u003e\u003e (begin (set! x 0) (loop-forever))\n\u003cKill the interpreter using Ctrl-C while evaluating the infinite loop\u003e\n````\n\nNow restart and check the value of x:\n\n````console\n$ ./schemeken 127.0.0.1:6789\n...\n35534:Ken/ken.c:968: recovering from turn 6\n...\n\u003chit enter\u003e\n\nRestoring state ...\nWelcome back!\n\n\u003e\u003e\u003e x\n42\n````\n\nFor a more elaborate tutorial on Schemeken's features, check out the [take-a-number tutorial](https://github.com/tvcutsem/schemeken/blob/master/doc/count.md).\n\nLanguage features\n=================\n\nAs Schemeken is built on the SLIP interpreter, it supports a minimal subset of Scheme.\nMost notable is lack of support for hygienic macros and file I/O procedures.\nSee `Slip/SlipNative.c:30` for a list of supported primitives.\n\nSchemeken adds the following primitives to make use of Ken's messaging system:\n\n* `(ken-id)`: returns the current Ken ID.\n\n  ````console\n  \u003e\u003e\u003e (ken-id)\n  \u003cken-id 127.0.0.1:6789\u003e\n  ````\n\n  Ken IDs are first class values: you can store them or pass them around like any other value.\n  You can embed Ken IDs into your Schemeken program by typing `#k` followed by an IP address/port, for example `#k127.0.0.1:6789`.\n  There is a shorthand for local Ken IDs: `#kXXXX` is the same as `#k127.0.0.1:XXXX`.\n\n* `(ken-send \u003cken-id\u003e \u003cexpr\u003e)`: Sends a value as a message to the given Ken process. Messages are serialized as their printed representation and deserialized as if read by the `(read)` primitive. This means valid messages currently include numbers, booleans, symbols, strings, characters, vectors and lists, but not procedures or continuations.\n\n  ````console\n  \u003e\u003e\u003e (ken-send (ken-id) \"Hello, world\")\n  \u003e\u003e\u003e\n  Received message from 127.0.0.1:6789:\n  Hello, world\n  Message end.\n  ````\n\n* `(set! ken-receive-handler (lambda (id msg) \u003cexpr\u003e))`: the global variable `ken-receive-handler` points to a procedure that processes incoming messages. The procedure takes as first argument the ken-id of the sender and as second argument the deserialized message. `\u003cexpr\u003e` is evaluated as a separate \"turn\", and thus thanks to Ken as an \"ACID\" transaction. The default receive handler just displays the `id` and `msg` on the console.\n\nFuture and related work\n=======================\n\n  * In coming versions we plan to layer a more elaborate messaging system on top of the Ken primitives, such as asynchronous messages with promises (non-blocking futures).\n  * SchemeKen inspired the work on [v8ken](https://github.com/supergillis/v8-ken), a distributed, resilient JavaScript engine.\n\nTeam\n====\n\nSchemeken was developed at the [Software Languages Lab](http://soft.vub.ac.be), Vrije Universiteit Brussel.\n\nQuestions? Contact us!\n\n  - [Dries Harnie](mailto://dharnie@vub.ac.be)\n  - [Joeri De Koster](mailto://jdekoste@vub.ac.be)\n  - [Tom Van Cutsem](mailto://tvcutsem@vub.ac.be)\n\nSchemeken is based on SLIP, a Scheme interpreter written by Prof. Theo D'Hondt.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvcutsem%2Fschemeken","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftvcutsem%2Fschemeken","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftvcutsem%2Fschemeken/lists"}