lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SCM-ification of parser


From: Erik Sandberg
Subject: Re: SCM-ification of parser
Date: Thu, 18 May 2006 13:27:10 +0200
User-agent: KMail/1.9.1

On Wednesday 17 May 2006 19:28, Erik Sandberg wrote:
> On Wednesday 17 May 2006 17:31, Han-Wen Nienhuys wrote:
> > Erik Sandberg schreef:
> > > The next step in parser split-up is to move rules out to Scheme. There
> > > will be a lot of functions, so I suggest we create a new make-music.scm
> > > for this.
> >
> > Regarding naming, we already have a make-foo-music for plain SCM use.
>
> I suppose however that it would be useful for scheme users to get access to
> all the syntax functions (make-syntax-simultaneous will be very similar to
> make-simultaneous-music, for instance). It could at least be good to let
> make-*-music be wrappers around syntax expressions, or vice versa.
>
> > I
> > propose to have
> >
> >   foo:  bar baz
> >      ;
> >
> >
> > =>
> >
> >    (make-syntax-foo .. )

I realised that there's a thinko in this naming convention: 
(make-syntax-foo ...) _is_ a syntax expression, and it _makes_ a music 
expression. 

If we use a separate module for syntax expressions, why not just say foo? 
e.g.:
(sequential-music .. )
for a syntax expression that represents (and, incidentally, produces music 
which represents) sequential music.

A patch for sequential, simultaneous and repeated music is attached. No fancy 
module tricks are used yet, but everything is done through macros that can be 
changed.

> One idea to connect both is to use some C++ macro and SCM initialization
> trickery, to register each MAKE_SYNTAX_EXPRESSION with the Lily_parser
> class, and provide a
>
>    (ly:parser-set-syntax 'music-sequence my-music-sequencer)

I don't understand. Why would the parser be interested in knowing which syntax 
functions that exist? AFAICS it should be sufficient for the parser to just 
evaluate the top-level syntax expression in the ly-syntax-constructurs module 
(so knowing about that module should be sufficient). The lexer needs to know 
about user-defined music functoins and macros of course, but those mechanisms 
do already exist.

-- 
Erik

Attachment: seq.diff
Description: Text Data

Attachment: ly-syntax-constructors.scm
Description: Text document


reply via email to

[Prev in Thread] Current Thread [Next in Thread]