lilypond-devel
[Top][All Lists]
Advanced

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

Re: \time vs. \times


From: Han-Wen Nienhuys
Subject: Re: \time vs. \times
Date: Sun, 02 Oct 2005 17:19:38 +0200
User-agent: Mozilla Thunderbird 1.0.6-1.1.fc4 (X11/20050720)

Erik Sandberg wrote:
Thus I have the following suggestion: Make a new command `\tuplet',
which is an alias of \times and deprecate the latter.


If we are going to change this, I suggest that we also make \tuplet a true Scheme function. Lots of commands that now have their own tokens in the grammar could be Schemified, and IMHO, iwbn to do this.


Yes, IWBN, but it also BASOOF (*) in the version that you present here, especially if we change \alternative. This is only worth if it really cleans up things, both in the syntax and in the internals.

FWIW, I also think that the parser is a big ugly kludge, but you'd better come up with a good reason to gratuitously a syntax change which can't be handled with convert-ly.

When looking at this problem, it's good to look at this set of commands:
\transpose c d {e}
\times 2/3 {c}
\set Voice.foo = bar
\repeat volta 2 {c d e f}
\repeat volta 2 {c d e f} \alternative {{d}{e}}

The main problems are:
- c 4 can either be interpreted as one music expression c4, or as an expression c followed by number 4. - Special characters such as . and = and / are problematic; for example c4*2/3 could be interpreted either as three parameters c4*2 / 3 or as a single music expression.
- repeat uses a variable number of parameters.

I've done some quick thinking again, and one idea is to do the follwoing:
1. Forbid simple music expressions which aren't enclosed in {} or <<>>. This has the points that
 - It seems to solve many problems with the grammar.
 - It is a simple rule, easy to remember.
 - It is consistent with e.g. toplevel_music.
- I don't know about any cases when it makes music much more tedious to enter. If you can enter a function name, you can also enter a pair of brackets. Technically, this restriction can be implemented by replacing Music by Composite_music everywhere in the grammar, except in Music_list.
2. The function parameter rule can look like:
parameter = pitch | '/' | '.' | '=' | NUMBER | String | Markup | Composite_music; 3. Re-implement \times, \transpose, etc. as music functions. This should be possible for all commands except \lyricsto (etc) and \repeat.

How would you deal with the variable number of parameters in

  \set Foo = #bar
  \set Bla.Foo = #bar

?

4. Change the repeat syntax to
\repeat volta 2 {c d e f}
\repeat volta 2 {c d e f \alternative {{d}{e}}}
I.e., alternative is a unary music function, which creates a music subexpression that is recognised only by the \repeat function. This is an ugly hack, but it removes a shift/reduce conflict, and it makes it possible to implement alternatives in the middle of a repeat (which Sven asked for some time ago).

No, it doesn't. It makes it possible to enter them conveniently. That's a big difference.





(*) Breaks A Shitload Of Old Files

--
 Han-Wen Nienhuys - address@hidden - http://www.xs4all.nl/~hanwen




reply via email to

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