Hi, I have yet another suggestion for how \relative can be soft-coded in a generic way. It's inspired by criticism of earlier attempts. It's similar, but not identical, to a previous suggestion.
Macros is that they operate on syntax, not on music. And the parser spits out music directly. So what I suggest, is to let the parser spit out yet another intermediate format, which is a Scheme expression that more or less corresponds to the the parse tree. So, for example, \repeat volta 2 { c8 d e \foo } would parse into a Scheme expression (repeat 'volta 2 (sequential <c8> <d8> <e8> foo)) where <c8> etc. are Music objects (or possibly expressions that evaluate to Music objects). When a top-level expression has been parsed into such scheme expression, it is evaluated in a Scheme module, where repeat, sequential etc. are defined as functions that return music; this evaluation produces the final music expression. Some benefits: - It will be easy to make \relative a music macro, by defining relative as a Scheme macro. - The parser will be reduced to a thin layer of syntactic sugar, so a large portion of parser.yy can be moved to scheme. Application of music functions and dereferencing of variables is completely outsourced to guile. - For those who want to do programming using lily syntax, it will be easy to export Scheme functions and macros to the lily parser at runtime. This will probably reduce the number of feature requests that come to our mailing lists. -- Erik _______________________________________________ lilypond-devel mailing list lilypond-devel@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-devel