From: Francois-Rene Rideau
Subject: Scribble - Scribe-like syntax for Common Lisp
Date: 
Message-ID: <87lm1ws7ff.fsf@Samaris.tunes.org>
Dear comp.lang.lisp'ers,

I just wrote Scribble, a very simple reader extension for CL, that provides
a Lisp-extended Lisp-embedded markup language based on the syntax of Scribe:
	http://www.cliki.net/Scribble

The Scribe being discussed is Manuel Serrano's document preparation system
as an extension to Bigloo Scheme. It isn't the antiquated system of same
name that inspired LaTeX and was used in early CMUCL documentation.
	http://www-sop.inria.fr/mimosa/fp/Scribe/

Scribble defines #\[ as a macro-character that reads the Scribe syntax
plus extensions of its own that I missed while using Scribe.
Scribble may be useful to you if like Scribe's syntax and want to use it
in Common Lisp application. It may also be used to read and recycle
existing Scribe documents.

The Scribe syntax is a markup syntax that allows to develop documents in
a programmatic way: Scribe markup is embedded in Lisp code, and itself
embeds Lisp code. "Tags" are actually calls to Lisp functions. The syntax
is thus integrated very nicely with the LISP syntax; it is infinitely nicer
than XML (which I admit is a very difficult thing not to do); and it allows
to be noticeably shorter than when writing some equivalently functional SEX.

For instance,
    * [foo ,(bar [,(baz) quux])]
        is read as
      (LIST "foo " (bar (LIST (baz) " quux")))

Scribble also contains some extensions to the Scribe syntax:
    * [:emph foo] is read as (emph "foo")
    * [: (font :size 1)bar] is read as (font :size 1 "bar")
    * [foo ,[:emph bar] baz] is (list "foo" (emph "bar") "baz")
    * [\:\\\[\]] is read as ":\[]" (well, actually that's ":\\[]")

Scribble also features an extension to Scribe's semantics:
	[foo] is actually (pp "foo") rather than "foo"
and you can vary the preprocessor with for instance
	(with-preprocessor #'string-upcase [foo])
This applies to the strings in the examples demonstrated above;
they have been shown without this extension for the sake of simplicity.

Scribble is in my personal CVS zone, under fare/fare/lisp/scribble.lisp.
The zone is mirrored for anonymous access by the TUNES project CVS,
	http://tunes.org/collaboration.html#CVS
so you can browse the cvsweb interface
	http://tunes.org/cgi-bin/cvsweb/fare/fare/lisp/scribble.lisp
or download the source code.
        http://tunes.org/cgi-bin/cvsweb/~checkout~/fare/fare/lisp/scribble.lisp?content-type=text/plain&only_with_tag=HEAD

Scribble depends on Meta by Jochen Schmidt (that uses the famous META
parsing technique documented by Henry Baker). You can install Meta on
debian with
        apt-get install cl-meta
Note that at the time of this writing, current debian package cl-meta 0.1-3
has two obvious bugs for which I give a bug fix in scribble.lisp.

Mind that this package does not implement any of Scribe's semantics.
It only implements the reader. In particular, there it doesn't include
an implementation of Scribe's semantics for keyword arguments. 

[ Fran�ois-Ren� �VB Rideau | Reflection&Cybernethics | http://fare.tunes.org ]
[  TUNES project for a Free Reflective Computing System  | http://tunes.org  ]
I once dreamt that children would be taught to not accept slogans on face
value, but to see through words and look for meaning or lack thereof. However,
I soon realized that by the time schools teach this piece of wisdom, it may
have itself become a slogan devoid of meaning, the sense of its words having
drifted or been otherwise corrupted by time and vice. You need more than dead
words to have people think by themselves; you need a living tradition.