Directives as a special case of foreign syntax Lassi Kortela (17 Feb 2021 13:53 UTC)
|
Re: Directives as a special case of foreign syntax
Lassi Kortela
(17 Feb 2021 13:58 UTC)
|
Re: Directives as a special case of foreign syntax
(no sender)
(17 Feb 2021 14:16 UTC)
|
Re: Directives as a special case of foreign syntax
(no sender)
(17 Feb 2021 14:09 UTC)
|
Directives as a special case of foreign syntax Lassi Kortela 17 Feb 2021 13:53 UTC
Hmm. Marc mentioned the ";;>" comments in Chibi-Scheme; they're used like this: ;;> \section{Interface} ;;> ;;> \procedure{(show out [args ...])} ;;> ;;> The primary interface. Analogous to CL's \scheme{format}, the first ;;> argument is either an output port or a boolean, with \scheme{#t} ;;> indicating \scheme{current-output-port} and \scheme{#f} indicating a ;;> string port. The remaining arguments are formatters, combined as with ;;> \scheme{each}, run with output to the given destination. If \var{out} ;;> is \scheme{#f} then the accumulated output is returned, otherwise ;;> the result is unspecified. So latex-like syntax (specifically, Scribble?) embedded in Scheme. This could be fed to a Scheme procedure to get an equivalent SXML representation, just like "#! Encoding: UTF-8" could be fed to a procedure to parse it. In both of these the idea is "embed foreign syntax into a Scheme file, and feed it into a parser that converts it into an S-expression". This is like a pass that comes before Scheme's usual macroexpansion pass, turning the file into something that is all S-expressions. The Scribble markup could be written: #! Scribble: #! \section{Interface} #! #! \procedure{(show out [args ...])} #! #! The primary interface. Analogous to CL's \scheme{format}, the first #! argument is either an output port or a boolean, with \scheme{#t} #! indicating \scheme{current-output-port} and \scheme{#f} indicating a #! string port. The remaining arguments are formatters, combined as #! End: I.e. some way to embed line-oriented external syntax like ";" comments, except that they're not ignored like comments are. And some way to mix different external syntaxes and work out what's what. "\section{Interface}” is Scribble syntax but "encoding: utf-8" is not. This is an open problem.