chibi-scheme(1)

πŸ“¦
version 0.12 Β· 2 versions
, in alpine 3.24, fedora 43, fedora 44, nixos 26.05, nixpkgs unstable

πŸ’– chibi-scheme β€” a tiny Scheme interpreter πŸ’–

okay bestie, gather round, because this is the manual page for chibi-scheme(1) from the General Commands Manual section, and it's literally the cutest little Scheme interpreter you'll ever meet. sit down, grab a boba, and let's get into it ✨


🌸 SYNOPSIS 🌸

chibi-scheme [-qQrRfTV] [-I path ] [-A path ] [-D feature ] [-m module ]
[-x module ] [-l file ] [-e expr ] [-p expr ] [-t module.id ] [-d image-
file ] [-i image-file ] [--] [ script argument ...  ]

πŸ¦‹ DESCRIPTION πŸ¦‹

chibi-scheme is a sample interactive Scheme interpreter for the chibi-scheme library. it's basically the "here's how you embed chibi-scheme in your own apps" demo, and honestly? it's also just genuinely useful on its own for writing scripts and doing interactive development. main character energy fr πŸ’…

when a script is given, that script gets loaded with SRFI-22 semantics β€” meaning it calls the procedure main (if it's defined) with a single parameter: a list of the command-line arguments, starting with the script name. and yes, this works exactly how you'd expect with shell #! semantics. she's a shebang girlie πŸŽ€

otherwise, if no script is given and no -e or -p options are given, you drop into an interactive repl β€” reading, evaluating, then printing expressions until EOF is reached. now, real talk: the repl it gives you is very minimal. if you want readline completion you're gonna want to wrap it with the rlwrap(1) program. and it doesn't catch signals either β€” to handle keyboard interrupts you can use the (chibi process) module. for a more sophisticated REPL with readline support, signal handling, module management and smarter read/write, you want the (chibi repl) module. and you can launch that automatically with:

chibi-scheme -R .

for convenience, the default language is the (scheme small) module, which includes every library in the R7RS small standard, plus transitively some other dependencies. that's actually a LOT β€” like, quite large β€” so if you want a more minimal startup language you'll want the -x module option described below. want a mostly R5RS-compatible language? use chibi-scheme -xscheme.r5rs. want just the core language used for bootstrapping? use chibi-scheme -xchibi, or its shortcut chibi-scheme -q. easy ✨


✨ OPTIONS ✨

first up, two lil house rules, bestie:

  • space is optional between options and their arguments.
  • options without arguments may not be chained together.

and to reduce the need for shell escapes, options with module arguments (-m, -x and -R) are written in dot notation, so the module (foo bar) gets written as foo.bar. iykyk 🌈

  • -V β€” prints the version information and exits. bye! πŸ‘‹
  • -q β€” "Quick" load, shortcut for chibi-scheme -xchibi. this is a slightly different language from (scheme base), which may load faster, and is guaranteed not to load any additional shared libraries.
  • -Q β€” extra "quick" load, shortcut for chibi-scheme -xchibi.primitive. the resulting environment will only contain the core syntactic forms and primitives coded in C. this is very fast and guaranteed not to load any external files, but it's also very limited. no cap.
  • -r[main] β€” run the "main" procedure when the script finishes loading, as in SRFI-22.
  • -R[module] β€” loads the given module and runs the "main" procedure it defines (which need not be exported) with a single argument of the list of command-line arguments, as in SRFI-22. the name "main" can be overridden with the -r option. [module] may be omitted, in which case it defaults to chibi.repl. so chibi-scheme -R is the recommended means to get the advanced REPL πŸ’–
  • -s β€” strict mode, escalating warnings to fatal errors. she does not play 😭
  • -f β€” change the reader to case-fold symbols as in R5RS.
  • -T β€” disables tail-call optimization. this can be useful for debugging in some cases, but it also makes it very likely to overflow the stack. be careful, bestie.
  • -hsize[/max_size] β€” specifies the initial size of the heap, in bytes, optionally followed by the maximum size the heap can grow to. size can be any integer value, optionally suffixed by "K" for kilobytes, "M" for megabytes, or "G" for gigabytes. ⚠️ -h must be specified before any options which load or evaluate Scheme code.
  • -Ipath β€” inserts path on the front of the load path list.
  • -Apath β€” appends path to the load path list.
  • -Dfeature β€” adds feature to the feature list, useful for cond-expanding different library code.
  • -mmodule β€” (see -xmodule below, they're a duo 🫢)
  • -xmodule β€” imports module as though (import module) were evaluated. if the -x version is used, then module replaces the current environment instead of being added to it.
  • -lfile β€” loads the Scheme source from the file file, searched for in the default load path.
  • -eexpr β€” evaluates the Scheme expression expr.
  • -pexpr β€” evaluates the Scheme expression expr then prints the result to stdout. ✨
  • -tmodule.id β€” enables tracing for the given identifier id in the module module.
  • -dimage-file β€” dumps the current Scheme heap to image-file and exits. this feature is still experimental.
  • -iimage-file β€” loads the Scheme heap from image-file instead of compiling the init file on the fly. this feature is also still experimental.
  • -b β€” makes stdio nonblocking (blocking by default). only available when lightweight threads are enabled.

🌈 ENVIRONMENT 🌈

  • CHIBI_MODULE_PATH β€” a colon separated list of directories to search for module files, inserted before the system default load paths. chibi-scheme searches for modules in directories in the following order:
    1. directories included with the -I path option
    2. directories included from CHIBI_MODULE_PATH
    3. system directories
    4. directories included with -A path option

if CHIBI_MODULE_PATH is unset, the directories "./lib" and "." are searched in order. set it to empty to only consider -I, system directories and -A.

  • CHIBI_IGNORE_SYSTEM_PATH β€” if set to anything but "0", system directories (as listed above) are not included in the search paths. πŸ™ˆ

πŸ‘‘ AUTHORS πŸ‘‘

Alex Shinn (alexshinn @ gmail . com) β€” the icon, the legend πŸ’œ


πŸ“ SEE ALSO πŸ“

more detailed information can be found in the manual included in doc/chibi.scrbl, included in the distribution.

the chibi-scheme home-page: https://github.com/ashinn/chibi-scheme/ 🌸


and that's the whole vibe check, bestie β€” this page is from the 4th Berkeley Distribution and it's chibi-scheme(1), so go forth and interpret some Scheme fr fr πŸ’–βœ¨πŸ¦‹

πŸ“¦ where this page comes from