17.3.4 Installing a Language

So far, we have used the reader meta-language to access languages like "literal.rkt" and "dollar-racket.rkt". If you want to use something like #lang literal directly, then you must move "literal.rkt" into a Racket collection named "literal" (see also Adding Collections). Specifically, move "literal.rkt" to "literal/lang/reader.rkt" for any directory name "literal". Then, install the "literal" directory as a package.

After moving the file and installing the package, you can use literal directly after #lang:

#lang literal

See raco: Racket Command-Line Tools for more information on using raco.

You can also make your language available for others to install by using the Racket package manager (see Package Management in Racket). After you create a "literal" package and register it with the Racket package catalog (see Package Catalogs), others can install it using raco pkg:

  raco pkg install literal

Once installed, others can invoke the language the same way: by using #lang literal at the top of a source file.

If you use a public source repository (e.g., GitHub), you can link your package to the source. As you improve the package, others can update their version using raco pkg:

  raco pkg update literal

See Package Management in Racket for more information about the Racket package manager.