_  -exp:   Configurable Scribble-like Syntax
7.1

_-exp: Configurable Scribble-like Syntax

Philip McGrath <philip at philipmcgrath dot com>

 #lang _-exp package: _-exp

The _-exp language is a metalanguage similar to #lang at-exp, in that it adds support for the @-reader to some base language.

However, rather than using @ as the command character, _-exp alows the programmer to specify one on a per-module basis. The default command character ƒ, i.e. the result of (integer->char 402). This is especially convienient when working with text in which the character @ appears frequently.

A module using _-exp takes the following form:
  module = 
#lang _-exp maybe-cmd-char-kw language-path
body ...
     
  maybe-cmd-char-kw = 
  | cmd-char-keyword
where cmd-char-keyword, if one is given, should be a keyword consisting of a single character (the desired command character) after the #:. For example, supplying #:ƒ would be equivalent to ommiting the cmd-char-keyword.

As an illustration, this module in _-exp
#lang _-exp racket/base
 
(define (goodnight who)
  ƒdisplayln[ƒstring-append{Goodnight, my ƒ|who|.}])
 
(goodnight "someone")
 
ƒgoodnight{love}
displays the following output:

Goodnight, my someone.
Goodnight, my love.

It could be re-written to use @ as the command character by using a cmd-char-keyword, like this:
#lang _-exp #:@ racket/base
 
(define (goodnight who)
  @displayln[@string-append{Goodnight, my @|who|.}])
 
(goodnight "someone")
 
@goodnight{love}

Changed in version 0.1 of package _-exp: Fixed an implementation flaw that caused _-exp to incorrectly interpret language-path as a module path, which is inconsistent with at-exp and somewhat defeats the purpose of a meta-language. Unfortunately this is a breaking change: while common cases like #lang _-exp racket continue to work properly, the previous implementation accepted e.g. #lang _-exp web-server/lang, which will now correctly cause an error. (What you should write is #lang _-exp web-server, but that didn’t work with the previous version.)