top-level-read-eval-print-loop

Function

Package: top-level

Arguments: nil

Although the basic algorithm of a Lisp listener is a simple repetition of

(print (eval (read))) 

it is greatly complicated by the need to handle command history, error levels, and other useful features. When an application needs a Lisp listener, often it will be simplest to use this, the default Lisp listener provided by the Allegro CL top level. It takes no arguments, but must be run inside a start-interactive-top-level function.

Thus, the Allegro CL idiom for running a standard Lisp listener communicating with *terminal-io* (this might be done in a *restart-app-function*) looks something like this:

(tpl:start-interactive-top-level *terminal-io* 
       #'tpl:top-level-read-eval-print-loop
        nil)

And the idiom for running a standard Lisp listener inside a window looks something like this:

(process-run-function "My Lisp Listener"
     #'tpl:start-interactive-top-level
     my-window-stream
     #'tpl:top-level-read-eval-print-loop
       nil)

Entry to top-level-read-eval-print-loop establishes additional bindings for certain variables used by the top level loop. These bindings are established inside any bindings established by start-interactive-top-level. The variables and initial binding values are taken from the alist bound to the variable *default-lisp-listener-bindings*.

An operator with this name but with a different definition is used in a Lisp image built with a minimal top level, that is built with the include-tpl argument to build-lisp-image specified nil. See Minimal top levels in building-images.htm for information on minimal top levels. Follow the link to see the definition (Lisp source code) of top-level-read-eval-print-loop in a minimal top level.

See top-level.htm for more information on the top level.

The documentation is described in introduction.htm and the index is in index.htm.

Copyright (c) 1998-2000, Franz Inc. Berkeley, CA., USA. All rights reserved.

Created 2000.10.5.