▼ |  | R6RS: Standard Language

1 | Running Top-Level Programs
2 | Installing Libraries
3 | R6RS Module Language
4 | Libraries and Collections
5 | Scheme Interoperability
6 | R6RS Conformance
7 | R6RS Libraries
| Index

top← prev up next →

### 1`` Running Top-Level Programs

To run a top-level program, either:

- Use the plt-r6rs executable, supplying the file that contains the program on the command line:

  plt-r6rs ‹program-file›

  Additional command-line arguments are propagated as command-line arguments to the program (accessed via command-line).

  To compile the file to bytecode (to speed future runs of the program), use plt-r6rs with the --compile flag:

  plt-r6rs --compile ‹program-file›

  The bytecode file is written in a "compiled" sub-directory next to ‹program-file›.

  For example, if "hi.scm" contains

  (import (rnrs))
  (display "hello\n")

  then

  plt-r6rs hi.scm

  prints “hello.”

- Prefix the program with #!r6rs, which counts as a comment from the R6RS perspective, but is a synonym for #lang r6rs from the PLT Scheme perspective. Such files can be run like any other PLT Scheme module, such as using mzscheme:

  mzscheme ‹program-file›

  or using DrScheme with the Module language. The file can also be compiled to bytecode using mzc:

  mzc ‹program-file›

  For example, if "hi.ss" contains

  #!r6rs
  (import (rnrs))
  (display "hello\n")

  then

  mzscheme hi.ss

  prints “hello.” Similarly, opening "hi.ss" in DrScheme and clicking Run prints “hello” within the DrScheme interactions window.

top← prev up next →