Version: 4.2.1

21.2 More PLT Schemes

Like “Scheme” itself, even “PLT Scheme” is more of an idea about programming languages than a language in the usual sense. Macros can extend a base language (as described in Macros), but macros and alternate parsers can construct an entirely new language from the ground up.

The #lang line that starts a PLT Scheme module declares the base language of the module. By “PLT Scheme,” we usually mean #lang followed by the base language scheme or scheme/base (of which scheme is an extension). The PLT Scheme distribution provides additional languages, including the following:

Each of these languages is used by starting module with the language name after #lang. For example, this source of this document starts with #lang scribble/doc.

PLT Scheme users can define their own languages. A language name maps to its implementation through a module path by adding /lang/reader. For example, the language name scribble/doc is expanded to scribble/doc/lang/reader, which is the module that implements the surface-syntax parser. The parser, in turn, generates a module form, which determines the base language at the level of syntactic forms an functions.

Some language names act as language loaders. For example, s-exp as a language uses the usual PLT Scheme parser for surface-syntax reading, and then it uses the module path after s-exp for the language’s syntactic forms. Thus, #lang s-exp "mylang.ss" parses the module body using the normal PLT Scheme reader, by then imports the initial syntax and functions for the module body from "mylang.ss". Similarly, #lang planet planet-path loads a language via PLaneT.