https://github.com/udem-dlteam/ribbit Skip to content Sign up * Why GitHub? + Features - + Mobile - + Actions - + Codespaces - + Packages - + Security - + Code review - + Issues - + Integrations - + GitHub Sponsors - + Customer stories - * Team * Enterprise * Explore + Explore GitHub - + Learn and contribute + Topics - + Collections - + Trending - + Learning Lab - + Open source guides - + Connect with others + The ReadME Project - + Events - + Community forum - + GitHub Education - + GitHub Stars program - * Marketplace * Pricing + Plans - + Compare plans - + Contact Sales - + Education - [ ] * # In this repository All GitHub | Jump to | * No suggested jump to results * # In this repository All GitHub | Jump to | * # In this organization All GitHub | Jump to | * # In this repository All GitHub | Jump to | Sign in Sign up {{ message }} udem-dlteam / ribbit Public * Notifications * Star 119 * Fork 4 * A small and portable Scheme implementation with AOT and incremental compilers that fits in 4K. It supports closures, tail calls, first-class continuations and a REPL. BSD-3-Clause License 119 stars 4 forks Star Notifications * Code * Issues 0 * Pull requests 0 * Actions * Projects 1 * Wiki * Security * Insights More * Code * Issues * Pull requests * Actions * Projects * Wiki * Security * Insights main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show Loading {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default Loading View all tags 1 branch 2 tags Code Loading Latest commit @feeley feeley Add usage instructions to README and port to older Gambit versions, G... ... 34cfa1d Nov 27, 2021 Add usage instructions to README and port to older Gambit versions, G... ...uile and Chicken 34cfa1d Git stats * 328 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time bench Revert Oct 1, 2021 docs Update repl-max.html and add repl-max-tc.html that does dynamic type ... Oct 19, 2021 src Add usage instructions to README and port to older Gambit versions, G... Nov 27, 2021 .gitignore Cleaning the repo -- removing the x86 version Sep 4, 2021 AUTHORS WIP Oct 1, 2021 CITATION.cff Fix affiliation Oct 19, 2021 LICENSE WIP Oct 1, 2021 README.md Add usage instructions to README and port to older Gambit versions, G... Nov 27, 2021 View code Ribbit Usage README.md Ribbit A small and portable Scheme implementation that supports closures, tail calls, first-class continuations, a REPL and AOT and incremental compilers. All that for a run time footprint around 4 KB! You can try the REPL with a minimal library here or try a more featureful version here. Please note that currently the incremental compiler used by the REPL only supports a subset of the Scheme special forms. In particular procedure definitions should use the syntax (define name (lambda ...)) . --------------------------------------------------------------------- Usage The Ribbit compiler is written in Scheme and can be executed with Gambit, Guile or Chicken. It has been tested with Gambit v4.7.5 and above. For the best experience install Gambit from https://github.com /gambit/gambit . Currently Ribbit supports the target languages C, JavaScript, Python and Scheme which are selectable with the compiler's -t option with c, js, py, and scm respectively. The compacted RVM code can be obtained with the target none which is the default. The -m option causes a minification of the generated program. This requires a recent version of Gambit. The -l option allows selecting the Scheme runtime library (located in the lib subdirectory). The min library has the fewest procedures and a REPL that supports the core Scheme forms only. The max library has most of the R4RS predefined procedures, except for file I/O. The max-tc library is like max but with run time type checking. The default is the max-tc library. Here are a few examples: Use Gambit to compile the minimal REPL to JavaScript and execute with nodejs: % cd src % gsi rsc.scm -t js -l min repl-min.scm % echo "(define f (lambda (n) (if (< n 2) n (+ (f (- n 1)) (f (- n 2))))))(f 25)" | node repl-min.scm.js > 0 > 75025 > Do the same but with Python: % cd src % gsi rsc.scm -t py -l min repl-min.scm % echo "(define f (lambda (n) (if (< n 2) n (+ (f (- n 1)) (f (- n 2))))))(f 25)" | python3 repl-min.scm.py > 0 > 75025 > Use Guile to compile the REPL with type checking to C and then compile RVM with gcc: % cd src % guile -s rsc.scm -t c -l max-tc repl-max.scm % gcc repl-max.scm.c % echo "(+ 1 (* 2 3))(car 0)" | ./a.out > 7 > *** type error > Use Chicken to compile the minimal REPL to minified Scheme and execute with Gambit: % cd src % csi -q rsc.scm -t scm -l min -m repl-min.scm % echo "(define twice (lambda (x) (* x 2)))(twice 21)" | gsi repl-min.scm.scm > 0 > 42 > About A small and portable Scheme implementation with AOT and incremental compilers that fits in 4K. It supports closures, tail calls, first-class continuations and a REPL. Resources Readme License BSD-3-Clause License Releases 2 tags Packages 0 No packages published Contributors 2 * @SamuelYvon SamuelYvon Samuel Yvon * @feeley feeley Marc Feeley Languages * Scheme 71.2% * C 7.5% * Shell 6.2% * Go 5.1% * Python 3.4% * JavaScript 2.7% * Other 3.9% * (c) 2021 GitHub, Inc. * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time. You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.