lilypond-devel
[Top][All Lists]
Advanced

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

Plan for implementing music macros


From: Erik Sandberg
Subject: Plan for implementing music macros
Date: Sat, 13 May 2006 21:41:21 +0200

Hi,

Here's an implementation plan for the new layer betw. parser and music
expressions (preliminary name "syntax expression"). I know it will
take some time before I can start implement it, but it's good to have
multiple parallel projects to work on, due to proofreading lag.

Implementation plan:
1. create a macro
MAKE_SYNTAX_EXPRESSION (name, num, ...)
so e.g. the rule for
REPEAT name num body
can be written as
MAKE_SYNTAX_EXPRESSION ("make-repeat", 3, $2, $3, $4);
once a function "repeat" has been defined properly in Scheme.

At the first stage, the macro will call the repeat function and return
the result.
2. Convert loads of parser rules to produce SCM instead of Music. (a
side-effect will be that we won't have to worry as much about
protection in the parser)
3. Change those parser rules to use MAKE_SYNTAX_EXPRESSION; this will
move stuff from parser.yy to Scheme.
4. Change MAKE_SYNTAX_EXPRESSION to not call the function directly;
insert commands in the parser to evaluate all 'top-level' expressions
(toplevel_music, score_body, ...). This should give the same result.
5. This should be sufficient. We can now e.g. make \relative a music macro.

--
Erik




reply via email to

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