denemo-devel
[Top][All Lists]
Advanced

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

[Denemo-devel] A first target for the gsoc project


From: Richard Shann
Subject: [Denemo-devel] A first target for the gsoc project
Date: Sat, 24 Jul 2010 10:08:43 +0100

Nils,
here is a program for proceeding methodically to LilyPond parse:

Take this chain of parser production rules from parser.ll in LilyPond's
git

lilypond:       /* empty */
        | lilypond toplevel_expression

toplevel_expression:
score_block:
        SCORE '{' score_body '}'
score_body: 
        music 

music:
        simple_music

simple_music:
        event_chord

event_chord:
        simple_chord_elements post_events

simple_chord_elements:
        simple_element

simple_element:
        pitch exclamations questions octave_check optional_notemode_duration 
optional_rest

pitch:
        steno_pitch

steno_pitch:
        NOTENAME_PITCH


Add to it the rules for those not completed in this chain, such as
post_events, with the actions being left empty
Likewise copy across the lexer rules for INITIAL state, with the lexer
returning NOTENAME_PITCH as the token when doing {WORD} (this is a
simplification for now).
You should then be able to parse a file containing 

\score {a b c d e f g}

That will be a good first milestone.

We can then create actions to make a denemo score from this.

The reasoning behind this is:

This switching states thing may not be as big a deal as I have been
thinking: e.g. the full LilyPond parser allows for you to include a
score block in some markup, so that you can quote a little bit of music
inside a footnote. For this it needs rules which we can ignore for the
present, which get you back out to lexing notes after you have got into
lexing markup.
I think if we start with a lexer and parser with just the bits implied
in that list above copied in from the LilyPond ones you will be able to
extend it bit by bit to include everything you need. Keep everything
with the same names, and in the same order as the lilypond parser and
lexer, so that it is sure that you can always add in any new bits of
syntax you need.

Richard





reply via email to

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