[mcclim-devel] More power to Drei

Christophe Rhodes csr21 at cantab.net
Sat Nov 10 15:27:02 UTC 2007


(I can't remember if this has been suggested or shot down before; I
might have a need for something like this soon, so I'd appreciate
guidance on it.)

How hard would it be, do people think, to provide from Drei something
like a regexp-token-syntax class, such that it becomes straightforward
for people to define simple tokenizing syntaxes?

An example might help; I'd like to be able to do

  (define-token-syntax chord-ontology ()
     ((root pitch accidental) pitches))
    (t error-token))

and have that be essentially all that's necessary to be able to use
the syntax in interesting ways, such as:

* being able to do (accept 'chord-ontology-token) and have the user
  input coloured in red unless it's valid, and be given the parse tree
  on return;

* being able to use Chord Ontology syntax in a buffer, where there is
  no parse per se, but the buffer is lexed according to the token

Is this sensible, worthwhile, possible, easy?  I would have thought
that we would have essentially all the components already, and it was
a matter of gluing them together, but maybe I'm forgetting a snag?



[ In my example, the nesting in the symbolic names is intended to
  correspond to register groups; in that example, "As:(1,3)" is
  intended to generate the equivalent of

    (make-instance 'chord-ontology-token
      'root (make-instance 'root 'pitch "A" 'accidental "s")
      'pitches "1,3")

  I hope that my intent is reasonably clear. ]

More information about the mcclim-devel mailing list