Previous: scheme programs syntax, Up: scheme programs [Index]
A top–level program is executed by treating the program similarly to a library, and evaluating its definitions and expressions. The semantics of a top–level body may be roughly explained by a simple translation into a library body: Each ?expression that appears before a definition in the top-level body is converted into a dummy definition
(define ?variable (begin ?expression ?unspecified))
where ?variable is a fresh identifier and ?unspecified is a side–effect–free expression returning an unspecified value. (It is generally impossible to determine which forms are definitions and expressions without concurrently expanding the body, so the actual translation is somewhat more complicated.)
On platforms that support it, a top–level program may access its
command line by calling the command-line
procedure, Command line access and exit values.