lilypond-user
[Top][All Lists]
Advanced

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

Re: Help getting started - lilypond structure


From: Mats Bengtsson
Subject: Re: Help getting started - lilypond structure
Date: Fri, 04 Jun 2004 15:06:15 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040113

If you want to implement a new parser, I recommend that you
look at the parser in LilyPond, lily/parser.yy. There, you will
at least learn that the full syntax is a fairly complex creature.

Joe Neeman wrote:
This is a follow-up on the question of lilypond structure. Here is how I think a lilypond file is organised. It is fairly important that I get this right, because I am trying to rewrite the lily parser in denemo. Please correct me if I'm wrong.

A Voice consists of a sequence of notes and various other objects (like time signatures, etc). The notes are entirely sequential.
Time signatures and that like are handled by the Staff contexts, so you
could in principle have
\new Staff{ \time 3/4 \key a \minor \new Voice {...}}


A \notes block consists of one or more Voice contexts. The Voices can be arranged sequentially or in parallel or a combination of both.

\notes just tells the lexicographic part of the front end to switch
input syntax. You could actually say
\notes \score{
  \new Staff  ...
}
for example.

A Staff consists of one or more \notes blocks. The blocks can be arranged sequentially or in parallel or a combination of both.

No, a Staff context contains one or more Voice contexts. To learn the
full context hierarchy, you could browse up through the program
documentation at
http://lilypond.org/doc/v2.2/Documentation/user/out-www/lilypond-internals/Contexts.html#Contexts
However, it is possible to redefine this hierarchy and add or remove
context types so if you want a full parser, you shouldn't hard code
this context hierarchy. In fact, the different contexts don't really
belong to the syntax but to the semantics.

A \score block consists of one or more Staves. The Staves can be arranged seqentially or in parallel or a combination of both.

Additionally, staves can be grouped (in parallel only) into Piano Staves, Grand Staves, Choir Staves and several other group types. These groups can be included in a \score block in the same way single staves are.

See above.

TIA,
Joe

PS, if I have "\notes{a4 b << {c d} {e f} >> }", then the {c d} by itself is a Voice context, right? And so is {e f}?

No, they will belong to the same Voice context, which you see if you
add a \stemUp in {c d}, for example. However, if you do
<< {c d} \\ {e f} >>
you will get two new Voice contexts.


    /Mats




reply via email to

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