You are looking at historical revision 43911 of this page. It may differ significantly from its current revision.

Module (chicken repl)

This module provides procedures you can use to create your own Read-Eval-Print Loop (REPL).

repl

[procedure] (repl [EVALUATOR])

Start a new read-eval-print loop. Sets the reset-handler so that any invocation of reset restarts the read-eval-print loop. Also changes the current exception-handler to display a message, write any arguments to the value of (current-error-port) and reset.

If EVALUATOR is given, it should be a procedure of one argument that is used in place of eval to evaluate each entered expression.

You can use quit to terminate the current read-eval-print loop. Encountering end-of-file also terminates the current REPL.

repl-prompt

[parameter] (repl-prompt)

A procedure that should evaluate to a string that will be printed before reading interactive input from the user in a read-eval-print loop. Defaults to (lambda () "#;N> ").

quit

[procedure] (quit [RESULT])

In the interpreter quit exits the currently active read-eval-print loop. In compiled code, it is equivalent to calling exit. See also the repl procedure.

reset

[procedure] (reset)

Reset program (Invokes reset-handler).

reset-handler

[parameter] (reset-handler)

A procedure of zero arguments that is called via reset. The default behavior in compiled code is to invoke the value of (exit-handler). The default behavior in the interpreter is to abort the current computation and to restart the read-eval-print loop.


Previous: Module (chicken read-syntax)

Next: Module (chicken sort)