{"id":13687369,"url":"https://github.com/udem-dlteam/ribbit","last_synced_at":"2026-02-28T23:09:21.124Z","repository":{"id":40403536,"uuid":"343830495","full_name":"udem-dlteam/ribbit","owner":"udem-dlteam","description":"A portable, compact and extensible Scheme implementation that is fully R4RS compliant. This includes closures, I/O, tail calls, first-class continuations and a Read Eval Print Loop (REPL). The R4RS Scheme REPL fits inside 6.5Kb !","archived":false,"fork":false,"pushed_at":"2025-12-18T18:29:59.000Z","size":42683,"stargazers_count":546,"open_issues_count":15,"forks_count":61,"subscribers_count":18,"default_branch":"main","last_synced_at":"2025-12-21T21:13:36.832Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Scheme","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/udem-dlteam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.md","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-03-02T16:00:21.000Z","updated_at":"2025-12-19T17:05:37.000Z","dependencies_parsed_at":"2023-02-19T15:15:17.733Z","dependency_job_id":"9c188bf0-a80d-4369-9713-dd96fc572d81","html_url":"https://github.com/udem-dlteam/ribbit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/udem-dlteam/ribbit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udem-dlteam%2Fribbit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udem-dlteam%2Fribbit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udem-dlteam%2Fribbit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udem-dlteam%2Fribbit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/udem-dlteam","download_url":"https://codeload.github.com/udem-dlteam/ribbit/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/udem-dlteam%2Fribbit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29954583,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T22:53:01.873Z","status":"ssl_error","status_checked_at":"2026-02-28T22:52:50.699Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":"2024-08-02T15:00:53.562Z","updated_at":"2026-02-28T23:09:21.113Z","avatar_url":"https://github.com/udem-dlteam.png","language":"Scheme","funding_links":[],"categories":["Languages","Scheme"],"sub_categories":["Scheme","Multi Lang"],"readme":"# Ribbit :frog:\n\nA portable, compact and extensible Scheme implementation that is **R4RS compliant**.\nThis includes closures, I/O, tail calls, first-class continuations and a Read Eval Print Loop (REPL).\n\n - **Very Compact**. Ribbit **removes unused code** and performs a specialized compression according to the\n    source code. [Read about our Scheme interpreter implementation (REPL) inside 7KB](https://arxiv.org/abs/2310.13589)\n - **Portable**. Ribbit currently runs on **25 different hosts**, including : *JavaScript*, *Assembly (x86)*,\n  *C*, *Python*, *POSIX Shell*, *Prolog* and more. [See all targets](#supported-targets).\n - **Extensible**. Ribbit can easily define new **primitives that interact with any of the 25 host languages**.\n   [Read about our markup system.](http://www.iro.umontreal.ca/~feeley/papers/OLearyFeeleyMOREVMS23.pdf)\n\nFor more information about Ribbit, [look at our papers](#research-and-papers),\n[try it on your computer](#quick-start) or try it online:\n\n\u003cp align=\"center\" font-size=\"2em\"\u003e\n \u003ch3 align=\"center\"\u003e\u003ca href=\"https://udem-dlteam.github.io/ribbit/repl-r4rs-tc.html\"\u003e🐸 Try the online R4RS REPL here 🐸\u003c/a\u003e\u003c/h3\u003e\n\u003c/p\u003e\n\n\n## Quick start\n\nRibbit is regularly tested with the following Scheme compilers and interpreters:\n  - Gambit v4.7.5+\n  - Guile v3.0.10+\n  - Chicken v5.4.0+\n  - Kawa v3.1.1+\n\nIf you have any of them installed on your system, it should work! Otherwise, you can install Gambit\n[from prebuilt binaries here](https://gambitscheme.org/latest/), or [from sources here](https://github.com/gambit/gambit).\n\nThe compiler's source code is in a single file: `src/rsc.scm`. After cloning\nthe repository, to interpret the Ribbit Scheme Compiler run your\nfavourite Scheme interpreter with the `rsc.scm` file inside the `src` directory:\n\n```\ncd src\n\ngsi rsc.scm --help      # for Gambit's interpreter\ncsi rsc.scm --help      # for Chicken's interpreter\n\nkawa rsc.scm --help     # for Kawa\nguile -s rsc.scm --help # for Guile\n```\n\nYou can also compile the Ribbit Scheme Compiler with Gambit or Chicken using `make`:\n\n```\ncd src\n\n# for Gambit\nmake rsc.exe\n\n# for Chicken Scheme\nSCHEME_COMPILER=chicken make rsc.exe\n\n# You can then run the compiler with:\n./rsc.exe --help\n```\n\nYou are now ready to jump to the [examples](#usage-examples)!\n\n## Development\n\nLike all systems, Ribbit has some quirks. If you encounter problems that are not documented or if you have any questions, please\nreach out in the issues section of Github.\n\n\u003c!-- If you are interested in contributing, you can look at [how to contribute](#how-to-contribute) --\u003e\n\n## Usage\n\nThe compiler's source code is in a single file: `src/rsc.scm`.\n\nRibbit currently compiles Scheme code to **more than 25 different host languages**. To select\na language, use the `-t` compiler option followed by the extension of the **target** language. For example, the option\ncan be followed by `js` (JavaScript), `asm` (x86 Assembly), `c` (C), `py` (Python), `hs` (Haskell), `pro` (Prolog) \nor [any of the supported targets](#supported-targets).\n\nThe `-m` option causes a minification of the generated program. This requires a\nrecent version of Gambit and may need aditionnal dependencies depending on the target under minification.\nSee the `host/\u003chost\u003e/minify` script of a specific host for details.\n\nThe `-l` option allows selecting the Scheme runtime library (located in the\n`lib` subdirectory). Here is a list of libraries :\n - `r4rs` : Adds all essential R4RS procedures. Includes a REPL that is fully R4RS compliant.\n - `r4rs/tc` : Like `r4rs` but with run time type checking.\n - `min`, `max` : Minimal library for small scheme implementations, including a minimal REPL.\n - `max-tc` : Like `min` and `max` but with run time type checking.\n - `define-macro` : Necessary for using the `define-macro` construct.\n\nFor more options, run the rsc with the `--help` option.\n\n## Usage Examples\n\nHere are a few examples to showcase the capabilities or Ribbit.\n\nAll commands need to be executed inside the `src` directory and supposes that `rsc.exe`\nhas been compiled with either Gambit or Chicken. To use the interpreter\ninstead, simply replace `./rsc.exe ...` with the correct interpreter invocation\n`\u003cscheme-interpreter\u003e rsc.scm ...`.\n\n### Use RSC to compile an R4RS compliant REPL to Python\n\n```\n$ ./rsc.exe -t py -l r4rs lib/r4rs/repl.scm -o repl.py\n$ python3 repl.py\n\u003e (+ 1 2)\n3\n\u003e (define handle (open-output-file \"test.txt\"))\n0\n\u003e (display \"Hello Ribbit!\" handle)\n0\n\u003e ^D (Ctrl-D)\n$ cat test.txt\nHello Ribbit!\n```\n\nDo the same but generating a JavaScript R4RS REPL:\n\n```\n$ ./rsc.exe -t js -l r4rs lib/r4rs/repl.scm -o repl.js\n$ node repl.js\n\u003e (+ 1 2)\n3\n```\n\nTry it with different hosts (make sure they support R4RS in the [supported target list](#supported-targets)) :\n\n```\n$ ./rsc.exe -t asm -l r4rs lib/r4rs/repl.scm -o repl.s # (x86 assembly, need linux as it generates an ELF file)\n$ ./rsc.exe -t c -l r4rs lib/r4rs/repl.scm -o repl.c\n$ ./rsc.exe -t hs -l r4rs lib/r4rs/repl.scm -o repl.hs\n```\n\n### Generate the world's smallest R4RS compliant REPL (takes 1 minute)\n\n```\n$ make repl-asm.exe\n$ ls -la repl-asm.exe\n-rwxr-xr-x  1 leonard  staff  6639  5 Aug 13:36 repl.exe\n!!! 6.5KB !!!\n$ echo '(+ 1 2)' | ./repl-asm.exe\n\u003e 3\n\u003e\n```\n\n### Generate a simple 'hello world' program in 25 different languages\n\n```\n$ echo '(display \"Hello from Ribbit!\")' \u003e hello.scm\n$ ./rsc.exe -t pro -l max hello.scm -o hello.pro # compile it with prolog\n$ swipl hello.pro # run it with swi-prolog\nHello from Ribbit!\n```\n\nThen, choose among 25 host languages :\n\n```\n$ ./rsc.exe -t asm   -l max hello.scm -o hello.asm\n$ ./rsc.exe -t c     -l max hello.scm -o hello.c\n$ ./rsc.exe -t hs    -l max hello.scm -o hello.hs\n$ ./rsc.exe -t js    -l max hello.scm -o hello.js\n$ ./rsc.exe -t py    -l max hello.scm -o hello.py\n$ ./rsc.exe -t clj   -l max hello.scm -o hello.clj\n$ ./rsc.exe -t lisp  -l max hello.scm -o hello.lisp\n$ ./rsc.exe -t pro   -l max hello.scm -o hello.pro\n$ ./rsc.exe -t scm   -l max hello.scm -o hello.scm\n$ ./rsc.exe -t sh    -l max hello.scm -o hello.sh\n$ ./rsc.exe -t go    -l max hello.scm -o hello.go\n$ ./rsc.exe -t lua   -l max hello.scm -o hello.lua\n$ ./rsc.exe -t ml    -l max hello.scm -o hello.ml\n$ ./rsc.exe -t idr   -l max hello.scm -o hello.idr\n$ ./rsc.exe -t scala -l max hello.scm -o hello.scala\n$ ./rsc.exe -t zig   -l max hello.scm -o hello.zig\n$ ./rsc.exe -t adb  -l max hello.scm -o hello.adb\n$ ./rsc.exe -t bas  -l max hello.scm -o hello.bas\n$ ./rsc.exe -t dart -l max hello.scm -o hello.dart\n$ ./rsc.exe -t java -l max hello.scm -o hello.java\n$ ./rsc.exe -t jl   -l max hello.scm -o hello.jl\n$ ./rsc.exe -t kt   -l max hello.scm -o hello.kt\n$ ./rsc.exe -t pl   -l max hello.scm -o hello.pl\n$ ./rsc.exe -t ps   -l max hello.scm -o hello.ps\n$ ./rsc.exe -t wat  -l max hello.scm -o hello.wat\n```\n\n### Create your own primitive in the the host language (js and C here):\n\n```\n$ cat examples/square.scm\n(cond-expand ((host py) ;; Python host\n              (define-primitive (square x)\n                \"lambda: push(pop()**2),\"))\n             ((host c) ;; C host\n              (define-primitive (square x)\n                \"{\n                  int x = NUM(pop());\n                  push2(TAG_NUM(x*x), PAIR_TAG);\n                 }\")))\n\n(%%putchar (square 8)) ;; prints '@' as 64 is the ASCII value of '@'\n(%%putchar 10) ;; prints a newline\n\n$ ./rsc.exe -t py examples/square.scm -o square.py\n$ python3 square.py\n@\n$ ./rsc.exe -t c examples/square.scm -o square.c\n$ gcc square.c -o square\n$ ./square\n@\n```\n\n### Generate a simple typed-checked max REPL in any of the hosts\n\nNote that the incremental compiler used by the repl-max.scm only supports a subset\nof the Scheme special forms. In particular procedure definitions should use\n`(define f (lambda (x) ...))` instead of `(define (f x) ...)`.\n\n```\n$ ./rsc.exe -t pro -l max-tc examples/repl-max.scm -o repl-max.pro\n$ swipl repl-max.pro\n\u003e (+ 1 2)\n3\n^D\n```\n\nChoose any language that supports the core features in the supported targets table and compile it by\nreplacing `pro` with the target language.\n\n### Other examples and tests\n\nFor other examples and tests, you can look at the [examples](./src/examples) and [tests](./src/tests)\ndirectories.\n\nThe makefile in the `src` directory has these make targets:\n\n      $ make check                     # Run all tests for all hosts (very long)\n\n      $ HOST=c make check              # Run tests for the C host\n\n      $ HOST=py PY_HOST_INTERPRETER=pypy make check  # Run tests for specific host and interpreter\n\n\n## Supported targets\n\nAll targets support a varying level of features. The table below tracks what\ntargets support which feature :\n - `core` means a traditional RVM implementation. These support minimal I/O (putchar, getchar only), and min/max/max-tc repls.\n - `variadics` means that the target supports functions with any numbers of parameters, for example, the `(define (f . rest) ...)` form.\n - `file I/O` means that the target supports the file I/O primitives (open-input-file, open-output-file, etc.).\n - `r4rs` means that the target supports the full R4RS `essential` standard. This relies on all the above features.\n\n| Language             | Core | variadics | file I/O  | R4RS |\n|----------------------|------|-----------|-----------|------|\n| x86 Assembly (`asm`) | ✅   |   ✅      |     ✅    |  ✅  |\n| C (`c`)              | ✅   |   ✅      |     ✅    |  ✅  |\n| Haskell (`hs`)       | ✅   |   ✅      |     ✅    |  ✅  |\n| JavaScript (`js`)    | ✅   |   ✅      |     ✅    |  ✅  |\n| Python (`py`)        | ✅   |   ✅      |     ✅    |  ✅  |\n| WASM (`wat`)         | ✅   |   ✅      |     ✅    |  ✅  |\n| Clojure (`clj`)      | ✅   |   ✅      |     ❌    |  ❌  |\n| Common Lisp (`lisp`) | ✅   |   ✅      |     ❌    |  ❌  |\n| Prolog (`pro`)       | ✅   |   ✅      |     ❌    |  ❌  |\n| Scheme (`scm`)       | ✅   |   ✅      |     ❌    |  ❌  |\n| Posix-Shell (`sh`)   | ✅   |   ✅      |     ❌    |  ❌  |\n| Go (`go`)            | ✅   |   ❌      |     ❌    |  ❌  |\n| Lua (`lua`)          | ✅   |   ❌      |     ❌    |  ❌  |\n| OCaml (`ml`)         | ✅   |   ❌      |     ❌    |  ❌  |\n| Idris 2 (`idr`)      | ✅   |   ❌      |     ❌    |  ❌  |\n| Scala (`scala`)      | ✅   |   ❌      |     ❌    |  ❌  |\n| Zig (`zig`)          | ✅   |   ❌      |     ❌    |  ❌  |\n| Ada (`adb`)          | ✅   |   ❌      |     ❌    |  ❌  |\n| Visual Basic (`bas`) | ✅   |   ❌      |     ❌    |  ❌  |\n| Dart (`dart`)        | ✅   |   ❌      |     ❌    |  ❌  |\n| Java (`java`)        | ✅   |   ❌      |     ❌    |  ❌  |\n| Julia (`jl`)         | ✅   |   ❌      |     ❌    |  ❌  |\n| Kotlin (`kt`)        | ✅   |   ❌      |     ❌    |  ❌  |\n| Perl (`pl`)          | ✅   |   ❌      |     ❌    |  ❌  |\n| PostScript (`ps`)    | ✅   |   ❌      |     ❌    |  ❌  |\n| Ruby (`rb`)          | 🚧   |   ❌      |     ❌    |  ❌  |\n| Rust (`rs`)          | 🚧   |   ❌      |     ❌    |  ❌  |\n\n\u003c!--\n## How to contribute\n\nIf you love Scheme and want to add a new host, improve a host, add a new library\nor fix a bug, don't hesitate to contribute with pull requests. More information about the\ndevelopment of Ribbit can be found in the [CONTRIBUTING.md](./CONTRIBUTING.md) file.\n--\u003e\n\n## Research and Papers\n\nYou can find [BibTeX entries for citing our work here](./CITATION.md).\n\nWe are actively developing Ribbit. If you have an idea, you can reach out to [leo-ard](https://oestoleary.com) or [feeley](https://www.iro.umontreal.ca/~feeley/).\nAll papers concerning Ribbit are available here :\n\n- [Leonard Oest O'Leary, Mathis Laroche and Marc Feeley, An R4RS compliant REPL in 7KB in SCHEME Workshop @ ICPF'23, January 2024](https://arxiv.org/abs/2310.13589)\n- [Leonard Oest O'Leary and Marc Feeley, A Compact and Extensible Portable Scheme VM. In MoreVMs Workshop (MOREVMS@PROGRAMMING'23), March 2023](http://www.iro.umontreal.ca/~feeley/papers/OLearyFeeleyMOREVMS23.pdf)\n- [Samuel Yvon and Marc Feeley, A Small Scheme VM, Compiler, and REPL in 4K. In Workshop on Virtual Machines and Intermediate Languages (VMIL@SPLASH'21), October 2021.](http://www.iro.umontreal.ca/~feeley/papers/YvonFeeleyVMIL21.pdf)\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudem-dlteam%2Fribbit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fudem-dlteam%2Fribbit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fudem-dlteam%2Fribbit/lists"}