Hi,
(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 ()
("(([A-G])(s|ss|b|bb)?):\(([0-9](,[0-9])*)\)"
((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
syntax.
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?
Cheers,
Christophe
[ 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. ]