CHIBI-SCHEME(1)

NAME
chibi-scheme - a tiny Scheme interpreter

SYNOPSIS
chibi-scheme [options] [--] [script argument ...]

DESCRIPTION
chibi-scheme is a sample interactive Scheme interpreter for the chibi-scheme library. It serves as an example of how to embed chibi-scheme in applications, and can be useful on its own for writing scripts and interactive development. When script is given, it will be loaded with SRFI-22 semantics, calling the procedure main (if defined) with a single parameter as a list of the command-line arguments, beginning with the script name. This works as expected with shell #! semantics. Otherwise, if no script given and no -e or -p options are present, an interactive REPL is entered, reading, evaluating, and then printing expressions until EOF is reached. The provided REPL is very minimal. For a more sophisticated REPL with readline support, signal handling, module management and smarter read/write you may want to use the (chibi repl) module. It can be launched automatically with chibi-scheme -R. For convenience the default language is the (scheme small) module which includes every library in the R7RS small standard, and some other dependencies. All of this together is actually quite large, so for a more minimal startup language you'll want to use the -xmodule option described below. The get mostly R5RS-compatible language, use chibi-scheme -xscheme.r5rs, or to get just the core language used for bootstrapping, use chibi-scheme -xchibi (or its shortcut chibi-scheme -q).

OPTIONS
Space is optional between options and their arguments. Options without arguments may not be chained together. To reduce the need for shell escapes, options with module arguments (-m, -x and -R) are written in dot notation. That is, spell module name (foo bar) as foo.bar on the command line.

-V  Print the version information and exit immediately.

-q  "Quick" load, a shortcut for chibi-scheme -xchibi. This is slightly different from (scheme base) -- which may load faster -- and is guaranteed to not load any additional shared libraries.

-Q  "Extra quick" load, a 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 is guaranteed to not load any external files, but is also very limited.

-r[main]
    Run the "main" procedure when the script finishes loading as in SRFI-22.

-R[module]
    Load the given module and run 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". Thus chibi-scheme -R is the recommended way to get an advanced REPL.

-s  Strict mode, treating warnings as fatal errors.

-f  Enable case-folding of symbols by the reader as in R5RS.

-T  Disable tail-call optimization. This can be useful for debugging in some cases, but also makes it very easy to overflow the stack.

-hsize[/max_size]
    Specify the initial size of the heap in bytes, optionally followed by the maximum size the heap can grow up to. size can be any integer value, optionally suffixed with "K" for kilobytes, "M" for megabytes, or "G" for gigabytes (all powers of 1024). -h must be specified before any options which load or evaluate Scheme code.

-Ipath
    Insert path in front of the load path list.

-Apath
    Append path to the load path list.

-Dfeature
    Add feature to the feature list, useful for cond-expanding different library code.

-mmodule

-xmodule
    Import module as if "(import module)" were evaluated. If the -x version is used, then module replaces the current environment instead of extending it.

-lfile
    Load Scheme code from file searched for in the default load path.

-eexpr
    Evaluate Scheme expression expr.

-pexpr
    Evaluate Scheme expression expr and print the result to stdout.

-tmodule.id
    Enable tracing for the given identifier id in module.

-dimage-file
    Dump the current Scheme heap to image-file and exit. This feature is experimental.

-iimage-file
    Load the Scheme heap from image-file instead of compiling the init file on the fly. This feature is experimental.

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:

    •   directories specified with the -I path option

    •   directories from CHIBI_MODULE_PATH

    •   system default directories

    •   directories specified with the -A path option
    If CHIBI_MODULE_PATH is not set, directories "./lib" and "." are searched before the system defaults (in that order).

AUTHORS
Alex Shinn

REPORTING BUGS
Please report bugs on Github (https://github.com/ashinn/chibi-scheme).

SEE ALSO
chibi-doc(1) chibi-ffi(1) snow-chibi(1)