Next: , Previous: , Up: Program structure   [Contents][Index]


5.1 Programs

A Scheme program consists of a sequence of expressions, definitions, and syntax definitions. Expressions are described in chapter Expressions; definitions and syntax definitions are the subject of the rest of the present chapter.

Programs are typically stored in files or entered interactively to a running Scheme system, although other paradigms are possible; questions of user interface lie outside the scope of this report. (Indeed, Scheme would still be useful as a notation for expressing computational methods even in the absence of a mechanical implementation.)

Definitions and syntax definitions occurring at the top level of a program can be interpreted declaratively. They cause bindings to be created in the top level environment or modify the value of existing top-level bindings. Expressions occurring at the top level of a program are interpreted imperatively; they are executed in order when the program is invoked or loaded, and typically perform some kind of initialization.

At the top level of a program (begin <form1> …,) is equivalent to the sequence of expressions, definitions, and syntax definitions that form the body of the begin.