A. LilyPond grammar

This appendix contains a description of the LilyPond grammar, as output from the parser.

Grammar

    1 start_symbol: lilypond

    3 start_symbol: "#{"  embedded_lilypond

    4 lilypond: /* empty */
    5         | lilypond toplevel_expression
    6         | lilypond assignment
    7         | lilypond error
    8         | lilypond "\version-error"

    9 toplevel_expression: header_block
   10                    | book_block
   11                    | bookpart_block
   12                    | BOOK_IDENTIFIER
   13                    | score_block
   14                    | composite_music
   15                    | full_markup
   16                    | full_markup_list
   17                    | SCM_TOKEN
   18                    | embedded_scm_active
   19                    | output_def

   20 lookup: LOOKUP_IDENTIFIER
   21       | LOOKUP_IDENTIFIER '.' symbol_list_rev

   22 embedded_scm_bare: SCM_TOKEN
   23                  | SCM_IDENTIFIER

   24 embedded_scm_active: SCM_IDENTIFIER
   25                    | scm_function_call
   26                    | lookup

   27 embedded_scm_bare_arg: SCM_ARG
   28                      | SCM_TOKEN
   29                      | FRACTION
   30                      | partial_markup
   31                      | full_markup_list
   32                      | context_modification
   33                      | header_block
   34                      | score_block
   35                      | context_def_spec_block
   36                      | book_block
   37                      | bookpart_block
   38                      | output_def
   39                      | lookup

   40 embedded_scm: embedded_scm_bare
   41             | scm_function_call
   42             | lookup

   43 embedded_scm_arg: embedded_scm_bare_arg
   44                 | scm_function_call
   45                 | music_assign

   46 scm_function_call: SCM_FUNCTION function_arglist

   47 embedded_lilypond_number: '-' embedded_lilypond_number
   48                         | bare_number_common
   49                         | UNSIGNED NUMBER_IDENTIFIER

   50 embedded_lilypond: /* empty */
   51                  | identifier_init_nonumber
   52                  | embedded_lilypond_number
   53                  | post_event post_events
   54                  | multiplied_duration
   55                  | music_embedded music_embedded music_list
   56                  | error
   57                  | "\version-error" embedded_lilypond

   58 lilypond_header_body: /* empty */
   59                     | lilypond_header_body assignment
   60                     | lilypond_header_body SCM_TOKEN
   61                     | lilypond_header_body embedded_scm_active

   62 lilypond_header: "\header" '{' lilypond_header_body '}'

   64 header_block:  lilypond_header

   65 assignment_id: STRING

   66 assignment: assignment_id '=' identifier_init
   67           | assignment_id '.' property_path '=' identifier_init
   68           | assignment_id ',' property_path '=' identifier_init

   69 identifier_init: identifier_init_nonumber
   70                | number_expression
   71                | symbol_list_part_bare '.' property_path
   72                | symbol_list_part_bare ',' property_path
   73                | post_event_nofinger post_events

   74 identifier_init_nonumber: header_block
   75                         | score_block
   76                         | book_block
   77                         | bookpart_block
   78                         | output_def
   79                         | context_def_spec_block
   80                         | music_assign
   81                         | pitch_or_music
   82                         | FRACTION
   83                         | string
   84                         | embedded_scm
   85                         | partial_markup
   86                         | full_markup_list
   87                         | context_modification
   88                         | partial_function "\etc"

   89 partial_function: MUSIC_FUNCTION function_arglist_partial
   90                 | EVENT_FUNCTION function_arglist_partial
   91                 | SCM_FUNCTION function_arglist_partial
   92                 | "\override" grob_prop_path '='
   93                 | "\set" context_prop_spec '='
   94                 | MUSIC_FUNCTION 
                          "scheme?" 
                          function_arglist_optional 
                          partial_function 
   95                 | EVENT_FUNCTION 
                          "scheme?" 
                          function_arglist_optional 
                          partial_function 
   96                 | SCM_FUNCTION 
                          "scheme?" 
                          function_arglist_optional 
                          partial_function 
   97                 | "\override" grob_prop_path '=' partial_function
   98                 | "\set" context_prop_spec '=' partial_function
   99                 | MUSIC_FUNCTION 
                          "optional?" 
                          "scheme?" 
                          function_arglist_nonbackup 
                          partial_function 
  100                 | EVENT_FUNCTION 
                          "optional?" 
                          "scheme?" 
                          function_arglist_nonbackup 
                          partial_function 
  101                 | SCM_FUNCTION 
                          "optional?" 
                          "scheme?" 
                          function_arglist_nonbackup 
                          partial_function 

  102 context_def_spec_block: "\context" '{' context_def_spec_body '}'

  103 context_mod_arg: embedded_scm

  105 context_mod_arg:  composite_music

  106 context_def_spec_body: /* empty */
  107                      | context_def_spec_body context_mod
  108                      | context_def_spec_body context_modification
  109                      | context_def_spec_body context_mod_arg

  110 book_block: "\book" '{' book_body '}'

  111 book_body: /* empty */
  112          | BOOK_IDENTIFIER
  113          | book_body paper_block
  114          | book_body bookpart_block
  115          | book_body score_block
  116          | book_body composite_music
  117          | book_body full_markup
  118          | book_body full_markup_list
  119          | book_body SCM_TOKEN
  120          | book_body embedded_scm_active

  122 book_body: book_body  lilypond_header
  123          | book_body error

  124 bookpart_block: "\bookpart" '{' bookpart_body '}'

  125 bookpart_body: /* empty */
  126              | BOOK_IDENTIFIER
  127              | bookpart_body paper_block
  128              | bookpart_body score_block
  129              | bookpart_body composite_music
  130              | bookpart_body full_markup
  131              | bookpart_body full_markup_list
  132              | bookpart_body SCM_TOKEN
  133              | bookpart_body embedded_scm_active

  135 bookpart_body: bookpart_body  lilypond_header
  136              | bookpart_body error

  137 score_block: "\score" '{' score_body '}'

  138 score_body: score_items
  139           | score_body error

  140 score_item: embedded_scm
  141           | music
  142           | output_def

  143 score_items: /* empty */
  144            | score_items score_item

  146 score_items: score_items  lilypond_header

  147 paper_block: output_def

  148 output_def: output_def_body '}'

  149 output_def_head: "\paper"
  150                | "\midi"
  151                | "\layout"

  152 output_def_head_with_mode_switch: output_def_head

  153 music_or_context_def: music_assign
  154                     | context_def_spec_block

  155 output_def_body: output_def_head_with_mode_switch '{'
  156                | output_def_body assignment
  157                | output_def_body embedded_scm_active
  158                | output_def_body SCM_TOKEN

  160 output_def_body: output_def_body  music_or_context_def
  161                | output_def_body error

  162 tempo_event: "\tempo" steno_duration '=' tempo_range
  163            | "\tempo" text steno_duration '=' tempo_range
  164            | "\tempo" text

  165 music_list: /* empty */
  166           | music_list music_embedded
  167           | music_list error

  168 braced_music_list: '{' music_list '}'

  169 music: music_assign
  170      | lyric_element_music
  171      | pitch_as_music

  172 pitch_as_music: pitch_or_music

  173 music_embedded: music
  174               | music_embedded_backup
  175               | music_embedded_backup 
                        "(backed-up?)" 
                        lyric_element_music 
  176               | multiplied_duration post_events

  177 music_embedded_backup: embedded_scm

  178 music_assign: simple_music
  179             | composite_music

  180 repeated_music: "\repeat" simple_string unsigned_number music
  181               | "\repeat" 
                        simple_string 
                        unsigned_number 
                        music 
                        "\alternative" 
                        braced_music_list 

  182 sequential_music: "\sequential" braced_music_list
  183                 | braced_music_list

  184 simultaneous_music: "\simultaneous" braced_music_list
  185                   | "<<" music_list ">>"

  186 simple_music: event_chord
  187             | music_property_def
  188             | context_change

  190 context_modification: "\with"  '{' context_mod_list '}'
  191                     | "\with" CONTEXT_MOD_IDENTIFIER
  192                     | CONTEXT_MOD_IDENTIFIER
  193                     | "\with" context_modification_arg

  194 context_modification_arg: embedded_scm
  195                         | MUSIC_IDENTIFIER

  196 optional_context_mods: context_modification_mods_list

  197 context_modification_mods_list: /* empty */
  198                               | context_modification_mods_list 
                                        context_modification 

  199 context_mod_list: /* empty */
  200                 | context_mod_list context_mod
  201                 | context_mod_list CONTEXT_MOD_IDENTIFIER
  202                 | context_mod_list context_mod_arg

  203 context_prefix: "\context" symbol optional_id optional_context_mods
  204               | "\new" symbol optional_id optional_context_mods

  205 new_lyrics: "\addlyrics" optional_context_mods lyric_mode_music
  206           | new_lyrics 
                    "\addlyrics" 
                    optional_context_mods 
                    lyric_mode_music 

  207 basic_music: music_function_call
  208            | repeated_music
  209            | music_bare
  210            | "\lyricsto" simple_string lyric_mode_music
  211            | "\lyricsto" symbol '=' simple_string lyric_mode_music

  212 contextable_music: basic_music
  213                  | pitch_as_music
  214                  | event_chord

  215 contexted_basic_music: context_prefix contextable_music new_lyrics
  216                      | context_prefix contextable_music
  217                      | context_prefix contexted_basic_music

  218 composite_music: basic_music
  219                | contexted_basic_music
  220                | basic_music new_lyrics

  221 music_bare: mode_changed_music
  222           | MUSIC_IDENTIFIER
  223           | grouped_music_list

  224 grouped_music_list: simultaneous_music
  225                   | sequential_music

  226 symbol_list_arg: SYMBOL_LIST
  227                | SYMBOL_LIST '.' symbol_list_rev
  228                | SYMBOL_LIST ',' symbol_list_rev

  229 symbol_list_rev: symbol_list_part
  230                | symbol_list_rev '.' symbol_list_part
  231                | symbol_list_rev ',' symbol_list_part

  232 symbol_list_part: symbol_list_element

  233 symbol_list_element: STRING
  234                    | embedded_scm_bare
  235                    | UNSIGNED

  236 symbol_list_part_bare: STRING
  237                      | UNSIGNED

  238 function_arglist_nonbackup: function_arglist_common
  239                           | "optional?" 
                                    "scheme?" 
                                    function_arglist_nonbackup 
                                    post_event_nofinger 
  240                           | "optional?" 
                                    "scheme?" 
                                    function_arglist_nonbackup 
                                    '-' 
                                    UNSIGNED 
  241                           | "optional?" 
                                    "scheme?" 
                                    function_arglist_nonbackup 
                                    '-' 
                                    REAL 
  242                           | "optional?" 
                                    "scheme?" 
                                    function_arglist_nonbackup 
                                    '-' 
                                    NUMBER_IDENTIFIER 
  243                           | "optional?" 
                                    "scheme?" 
                                    function_arglist_nonbackup 
                                    embedded_scm_arg 
  244                           | "optional?" 
                                    "scheme?" 
                                    function_arglist_nonbackup 
                                    bare_number_common 
  245                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    pitch_or_music 
  246                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    multiplied_duration 
  247                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    reparsed_rhythm 
  248                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    bare_number_common 
  249                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    SCM_ARG 
  250                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    lyric_element_music 
  251                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    symbol_list_arg 

  252 reparsed_rhythm: DURATION_ARG dots multipliers post_events

  253 function_arglist_nonbackup_reparse: "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            SCM_IDENTIFIER 
  254                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            pitch 
  255                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            steno_tonic_pitch 
  256                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            STRING 
  257                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            full_markup 
  258                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            UNSIGNED 
  259                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            DURATION_IDENTIFIER 

  260 function_arglist_backup: function_arglist_common
  261                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 embedded_scm_arg 
  262                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 post_event_nofinger 
  263                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 pitch 
  264                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 steno_tonic_pitch 
  265                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 full_markup 
  266                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 UNSIGNED 
  267                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 REAL 
  268                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 NUMBER_IDENTIFIER 
  269                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 '-' 
                                 UNSIGNED 
  270                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 '-' 
                                 REAL 
  271                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 '-' 
                                 NUMBER_IDENTIFIER 
  272                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 DURATION_IDENTIFIER 
  273                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 SCM_IDENTIFIER 
  274                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 STRING 
  275                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 pitch_or_music 
  276                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 bare_number_common 
  277                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 multiplied_duration 
  278                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 reparsed_rhythm 
  279                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 symbol_list_arg 

  280 function_arglist: function_arglist_nonbackup
  281                 | "optional?" 
                          "scheme?" 
                          function_arglist_skip_nonbackup 
                          "\default" 

  282 function_arglist_skip_nonbackup: function_arglist_nonbackup
  283                                | "optional?" 
                                         "scheme?" 
                                         function_arglist_skip_nonbackup 

  284 function_arglist_partial: "scheme?" function_arglist_optional
  285                         | "scheme?" function_arglist_partial_optional
  286                         | "optional?" 
                                  "scheme?" 
                                  function_arglist_nonbackup 
  287                         | "optional?" 
                                  "scheme?" 
                                  function_arglist_partial 

  288 function_arglist_partial_optional: "scheme?" function_arglist_optional
  289                                  | "scheme?" 
                                           function_arglist_partial_optional 
  290                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist_backup 
  291                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist_partial_optional 

  292 function_arglist_common: EXPECT_NO_MORE_ARGS
  293                        | "scheme?" 
                                 function_arglist_optional 
                                 embedded_scm_arg 
  294                        | "scheme?" 
                                 function_arglist_optional 
                                 bare_number_common 
  295                        | "scheme?" 
                                 function_arglist_optional 
                                 post_event_nofinger 
  296                        | "scheme?" 
                                 function_arglist_optional 
                                 '-' 
                                 NUMBER_IDENTIFIER 
  297                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 SCM_ARG 
  298                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 lyric_element_music 
  299                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 pitch_or_music 
  300                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 bare_number_common 
  301                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 multiplied_duration 
  302                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 reparsed_rhythm 
  303                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 symbol_list_arg 

  304 function_arglist_common_reparse: "scheme?" 
                                         function_arglist_optional 
                                         SCM_IDENTIFIER 
  305                                | "scheme?" 
                                         function_arglist_optional 
                                         pitch 
  306                                | "scheme?" 
                                         function_arglist_optional 
                                         steno_tonic_pitch 
  307                                | "scheme?" 
                                         function_arglist_optional 
                                         STRING 
  308                                | "scheme?" 
                                         function_arglist_optional 
                                         full_markup 
  309                                | "scheme?" 
                                         function_arglist_optional 
                                         UNSIGNED 
  310                                | "scheme?" 
                                         function_arglist_optional 
                                         DURATION_IDENTIFIER 
  311                                | "scheme?" 
                                         function_arglist_optional 
                                         '-' 
                                         UNSIGNED 
  312                                | "scheme?" 
                                         function_arglist_optional 
                                         '-' 
                                         REAL 

  313 function_arglist_optional: function_arglist_backup
  314                          | "optional?" 
                                   "scheme?" 
                                   function_arglist_skip_backup 
                                   "\default" 
  315                          | function_arglist_skip_backup "(backed-up?)"

  316 function_arglist_skip_backup: function_arglist_backup
  317                             | "optional?" 
                                      "scheme?" 
                                      function_arglist_skip_backup 

  318 music_function_call: MUSIC_FUNCTION function_arglist

  319 optional_id: /* empty */
  320            | '=' simple_string

  322 lyric_mode_music:  grouped_music_list
  323                 | MUSIC_IDENTIFIER

  324 mode_changed_music: mode_changing_head grouped_music_list
  325                   | mode_changing_head_with_context 
                            optional_context_mods 
                            grouped_music_list 

  326 mode_changing_head: "\notemode"
  327                   | "\drummode"
  328                   | "\figuremode"
  329                   | "\chordmode"
  330                   | "\lyricmode"

  331 mode_changing_head_with_context: "\drums"
  332                                | "\figures"
  333                                | "\chords"
  334                                | "\lyrics"

  335 context_change: "\change" symbol '=' simple_string

  336 property_path: symbol_list_rev

  337 property_operation: symbol '=' scalar
  338                   | "\unset" symbol
  339                   | "\override" revert_arg '=' scalar
  340                   | "\revert" revert_arg

  341 revert_arg: revert_arg_backup "(backed-up?)" symbol_list_arg

  342 revert_arg_backup: revert_arg_part

  343 revert_arg_part: symbol_list_part
  344                | revert_arg_backup 
                         "(backed-up?)" 
                         SCM_ARG 
                         '.' 
                         symbol_list_part 
  345                | revert_arg_backup 
                         "(backed-up?)" 
                         SCM_ARG 
                         ',' 
                         symbol_list_part 
  346                | revert_arg_backup 
                         "(backed-up?)" 
                         SCM_ARG 
                         symbol_list_part 

  347 context_def_mod: "\consists"
  348                | "\remove"
  349                | "\accepts"
  350                | "\defaultchild"
  351                | "\denies"
  352                | "\alias"
  353                | "\type"
  354                | "\description"
  355                | "\name"

  356 context_mod: property_operation
  357            | context_def_mod STRING
  358            | context_def_mod embedded_scm

  359 grob_prop_spec: symbol_list_rev

  360 grob_prop_path: grob_prop_spec
  361               | grob_prop_spec property_path

  362 context_prop_spec: symbol_list_rev

  363 simple_revert_context: symbol_list_part

  364 music_property_def: "\override" grob_prop_path '=' scalar
  365                   | "\revert" simple_revert_context revert_arg
  366                   | "\set" context_prop_spec '=' scalar
  367                   | "\unset" context_prop_spec

  368 string: STRING
  369       | full_markup

  370 text: STRING
  371     | full_markup
  372     | embedded_scm_bare

  373 simple_string: STRING
  374              | embedded_scm_bare

  375 symbol: STRING
  376       | embedded_scm_bare

  377 scalar: embedded_scm_arg
  378       | pitch_or_music
  379       | SCM_IDENTIFIER
  380       | bare_number
  381       | '-' bare_number
  382       | string
  383       | symbol_list_part_bare '.' property_path
  384       | symbol_list_part_bare ',' property_path

  385 event_chord: simple_element post_events
  386            | CHORD_REPETITION optional_notemode_duration post_events
  387            | MULTI_MEASURE_REST optional_notemode_duration post_events
  388            | tempo_event
  389            | note_chord_element

  390 note_chord_element: chord_body optional_notemode_duration post_events

  391 chord_body: "<" chord_body_elements ">"
  392           | FIGURE_OPEN figure_list FIGURE_CLOSE

  393 chord_body_elements: /* empty */
  394                    | chord_body_elements chord_body_element

  395 chord_body_element: pitch_or_tonic_pitch 
                            exclamations 
                            questions 
                            octave_check 
                            post_events 
  396                   | DRUM_PITCH post_events
  397                   | music_function_chord_body

  398 music_function_chord_body: music_function_call
  399                          | MUSIC_IDENTIFIER
  400                          | embedded_scm

  401 event_function_event: EVENT_FUNCTION function_arglist

  402 post_events: /* empty */
  403            | post_events post_event

  404 post_event_nofinger: direction_less_event
  405                    | script_dir music_function_call
  406                    | "--"
  407                    | "__"
  408                    | script_dir direction_reqd_event
  409                    | script_dir direction_less_event
  410                    | '^' fingering
  411                    | '_' fingering

  412 post_event: post_event_nofinger
  413           | '-' fingering

  414 string_number_event: E_UNSIGNED

  415 direction_less_event: string_number_event
  416                     | EVENT_IDENTIFIER
  417                     | tremolo_type
  418                     | event_function_event

  419 direction_reqd_event: gen_text_def
  420                     | script_abbreviation

  421 octave_check: /* empty */
  422             | '=' quotes

  423 quotes: /* empty */
  424       | sub_quotes
  425       | sup_quotes

  426 sup_quotes: '''
  427           | sup_quotes '''

  428 sub_quotes: ','
  429           | sub_quotes ','

  430 steno_pitch: NOTENAME_PITCH quotes

  431 steno_tonic_pitch: TONICNAME_PITCH quotes

  432 pitch: steno_pitch
  433      | PITCH_IDENTIFIER quotes

  434 pitch_or_tonic_pitch: pitch
  435                     | steno_tonic_pitch

  436 gen_text_def: full_markup
  437             | STRING
  438             | embedded_scm

  439 fingering: UNSIGNED

  440 script_abbreviation: '^'
  441                    | '+'
  442                    | '-'
  443                    | '!'
  444                    | ">"
  445                    | '.'
  446                    | '_'

  447 script_dir: '_'
  448           | '^'
  449           | '-'

  450 maybe_notemode_duration: /* empty */
  451                        | multiplied_duration

  452 optional_notemode_duration: maybe_notemode_duration

  453 steno_duration: UNSIGNED dots
  454               | DURATION_IDENTIFIER dots

  455 multiplied_duration: steno_duration multipliers

  456 dots: /* empty */
  457     | dots '.'

  458 multipliers: /* empty */
  459            | multipliers '*' UNSIGNED
  460            | multipliers '*' FRACTION

  461 tremolo_type: ':'
  462             | ':' UNSIGNED

  463 bass_number: UNSIGNED
  464            | STRING
  465            | full_markup
  466            | embedded_scm_bare

  467 figured_bass_alteration: '-'
  468                        | '+'
  469                        | '!'

  470 bass_figure: "_"
  471            | bass_number
  472            | bass_figure ']'
  473            | bass_figure figured_bass_alteration
  474            | bass_figure figured_bass_modification

  475 figured_bass_modification: "\+"
  476                          | "\!"
  477                          | '/'
  478                          | "\"

  479 br_bass_figure: bass_figure
  480               | '[' bass_figure

  481 figure_list: /* empty */
  482            | figure_list br_bass_figure

  483 optional_rest: /* empty */
  484              | "\rest"

  485 pitch_or_music: pitch 
                        exclamations 
                        questions 
                        octave_check 
                        maybe_notemode_duration 
                        optional_rest 
                        post_events 
  486               | new_chord post_events

  487 simple_element: DRUM_PITCH optional_notemode_duration
  488               | RESTNAME optional_notemode_duration

  489 lyric_element: full_markup
  490              | STRING
  491              | LYRIC_ELEMENT

  492 lyric_element_music: lyric_element 
                             optional_notemode_duration 
                             post_events 

  493 new_chord: steno_tonic_pitch maybe_notemode_duration
  494          | steno_tonic_pitch 
                   optional_notemode_duration 
                   chord_separator 
                   chord_items 

  495 chord_items: /* empty */
  496            | chord_items chord_item

  497 chord_separator: ":"
  498                | "^"
  499                | "/" steno_tonic_pitch
  500                | "/+" steno_tonic_pitch

  501 chord_item: chord_separator
  502           | step_numbers
  503           | CHORD_MODIFIER

  504 step_numbers: step_number
  505             | step_numbers '.' step_number

  506 step_number: UNSIGNED
  507            | UNSIGNED '+'
  508            | UNSIGNED "-"

  509 tempo_range: unsigned_number
  510            | unsigned_number '-' unsigned_number

  511 number_expression: number_expression '+' number_term
  512                  | number_expression '-' number_term
  513                  | number_term

  514 number_term: number_factor
  515            | number_factor '*' number_factor
  516            | number_factor '/' number_factor

  517 number_factor: '-' number_factor
  518              | bare_number

  519 bare_number_common: REAL
  520                   | NUMBER_IDENTIFIER
  521                   | REAL NUMBER_IDENTIFIER

  522 bare_number: bare_number_common
  523            | UNSIGNED
  524            | UNSIGNED NUMBER_IDENTIFIER

  525 unsigned_number: UNSIGNED
  526                | NUMBER_IDENTIFIER
  527                | embedded_scm

  528 exclamations: /* empty */
  529             | exclamations '!'

  530 questions: /* empty */
  531          | questions '?'

  533 full_markup_list: "\markuplist" 0 markup_list

  534 markup_mode: "\markup"

  535 full_markup: markup_mode markup_top

  536 partial_markup: markup_mode markup_partial_function "\etc"

  537 markup_top: markup_list
  538           | markup_head_1_list simple_markup
  539           | simple_markup

  541 markup_scm: embedded_scm 1 "(backed-up?)"

  542 markup_list: markup_composed_list
  543            | markup_uncomposed_list

  544 markup_uncomposed_list: markup_braced_list
  545                       | markup_command_list
  546                       | markup_scm MARKUPLIST_IDENTIFIER

  548 markup_uncomposed_list: "\score-lines" 2 '{' score_body '}'

  549 markup_composed_list: markup_head_1_list markup_uncomposed_list

  550 markup_braced_list: '{' markup_braced_list_body '}'

  551 markup_braced_list_body: /* empty */
  552                        | markup_braced_list_body markup
  553                        | markup_braced_list_body markup_list

  554 markup_command_list: MARKUP_LIST_FUNCTION markup_command_list_arguments

  555 markup_command_basic_arguments: "markup-list?" 
                                        markup_command_list_arguments 
                                        markup_list 
  556                               | "scheme?" 
                                        markup_command_list_arguments 
                                        embedded_scm 
  557                               | EXPECT_NO_MORE_ARGS

  558 markup_command_list_arguments: markup_command_basic_arguments
  559                              | "markup?" 
                                       markup_command_list_arguments 
                                       markup 

  560 markup_partial_function: MARKUP_FUNCTION markup_arglist_partial
  561                        | markup_head_1_list 
                                 MARKUP_FUNCTION 
                                 markup_arglist_partial 

  562 markup_arglist_partial: "markup?" markup_arglist_partial
  563                       | "scheme?" markup_arglist_partial
  564                       | "markup?" markup_command_list_arguments
  565                       | "scheme?" markup_command_list_arguments

  566 markup_head_1_item: MARKUP_FUNCTION 
                            "markup?" 
                            markup_command_list_arguments 

  567 markup_head_1_list: markup_head_1_item
  568                   | markup_head_1_list markup_head_1_item

  569 simple_markup: STRING

  571 simple_markup: "\score" 3 '{' score_body '}'
  572              | MARKUP_FUNCTION markup_command_basic_arguments
  573              | markup_scm MARKUP_IDENTIFIER

  574 markup: markup_head_1_list simple_markup
  575       | simple_markup


Terminals, with rules where they appear



    255 256 257 258 259 261 262 263 264 265 266 267 268 269 270 271
    257 258 259 261 262 263 264 265 266 267 268 269 270 271 272 273
    272 273 274 281 283 284 285 286 287 288 289 290 291 293 294 295
    274 281 283 286 287 290 291 314 317
    296 304 305 306 307 308 309 310 311 312 314 317 556 563 565
    297 298 299 300 301 302 303
    506 507 508 523 524 525
    510 512 517
    569
"#{" (340) 3
"(backed-up?)" (335) 175 315 341 344 345 346 541
"(reparsed?)" (336) 245 246 247 248 249 250 251 275 276 277 278 279
"-" (320) 508
"--" (265) 406
"/" (321) 499
"/+" (317) 500
":" (319) 497
"<" (322) 391
"<<" (324) 185
">" (323) 391 444
">>" (325) 185
"\!" (327) 476
"\" (326) 478
"\+" (328) 475
"\accepts" (273) 349
"\addlyrics" (262) 205 206
"\alias" (274) 352
"\alternative" (260) 181
"\book" (275) 110
"\bookpart" (276) 124
"\change" (277) 335
"\chordmode" (278) 329
"\chords" (279) 333
"\consists" (280) 347
"\context" (281) 102 203
"\default" (282) 281 314
"\defaultchild" (283) 350
"\denies" (284) 351
"\description" (285) 354
"\drummode" (286) 327
"\drums" (287) 331
"\etc" (288) 88 536
"\figuremode" (289) 328
"\figures" (290) 332
"\header" (291) 62
"\layout" (293) 151
"\lyricmode" (294) 330
"\lyrics" (295) 334
"\lyricsto" (296) 210 211
"\markup" (297) 534
"\markuplist" (298) 533
"\midi" (299) 150
"\name" (300) 355
"\new" (316) 204
"\notemode" (301) 326
"\override" (302) 92 97 339 364
"\paper" (303) 149
"\remove" (304) 348
"\repeat" (259) 180 181
"\rest" (305) 484
"\revert" (306) 340 365
"\score" (307) 137 571
"\score-lines" (308) 548
"\sequential" (309) 182
"\set" (310) 93 98 366
"\simultaneous" (311) 184
"\tempo" (312) 162 163 164
"\type" (313) 353
"\unset" (314) 338 367
"\version-error" (292) 8 57
"\with" (315) 190 191 193
"^" (318) 498
"_" (331) 470
"__" (264) 407
"end of input" (0) 0
"markup-list?" (337) 555
"markup?" (333) 559 562 564 566
"optional?" (338) 99 100 101 239 240 241 242 243 244 253 254 255 256
"scheme?" (334) 94 95 96 99 100 101 239 240 241 242 243 244 253 254
'!' (33) 443 469 529
''' (39) 426 427
'*' (42) 459 460 515
'+' (43) 441 468 507 511
',' (44) 68 72 228 231 345 384 428 429
'-' (45) 47 240 241 242 269 270 271 296 311 312 381 413 442 449 467
'.' (46) 21 67 71 227 230 344 383 445 457 505
'/' (47) 477 516
':' (58) 461 462
'=' (61) 66 67 68 92 93 97 98 162 163 211 320 335 337 339 364 366 422
'?' (63) 531
'[' (91) 480
']' (93) 472
'^' (94) 410 440 448
'_' (95) 411 446 447
'{' (123) 62 102 110 124 137 155 168 190 548 550 571
'}' (125) 62 102 110 124 137 148 168 190 548 550 571
BOOK_IDENTIFIER (341) 12 112 126
CHORD_MODIFIER (342) 503
CHORD_REPETITION (343) 386
COMPOSITE (261)
CONTEXT_MOD_IDENTIFIER (344) 191 192 201
DRUM_PITCH (345) 396 487
DURATION_ARG (346) 252
DURATION_IDENTIFIER (263) 259 272 310 454
E_UNSIGNED (268) 414
error (256) 7 56 123 136 139 161 167
EVENT_FUNCTION (266) 90 95 100 401
EVENT_IDENTIFIER (267) 416
EXPECT_NO_MORE_ARGS (339) 292 557
FIGURE_CLOSE (329) 392
FIGURE_OPEN (330) 392
FRACTION (347) 29 82 460
LOOKUP_IDENTIFIER (348) 20 21
LYRIC_ELEMENT (349) 491
MARKUP_FUNCTION (350) 560 561 566 572
MARKUP_IDENTIFIER (352) 573
MARKUP_LIST_FUNCTION (351) 554
MARKUPLIST_IDENTIFIER (353) 546
MULTI_MEASURE_REST (332) 387
MUSIC_FUNCTION (354) 89 94 99 318
MUSIC_IDENTIFIER (355) 195 222 323 399
NOTENAME_PITCH (356) 430
NUMBER_IDENTIFIER (271) 49 242 268 271 296 520 521 524 526
PITCH_IDENTIFIER (357) 433
PREC_BOT (258)
PREC_TOP (272)
REAL (269) 241 267 270 312 519 521
RESTNAME (358) 488
SCM_ARG (359) 27 249 297 344 345 346
SCM_FUNCTION (360) 46 91 96 101
SCM_IDENTIFIER (361) 23 24 253 273 304 379
SCM_TOKEN (362) 17 22 28 60 119 132 158
STRING (363) 65 233 236 256 274 307 357 368 370 373 375 437 464 490
SYMBOL_LIST (364) 226 227 228
TONICNAME_PITCH (365) 431
UNARY_MINUS (366)
UNSIGNED (270) 49 235 237 240 258 266 269 309 311 439 453 459 462 463

Nonterminals, with rules where they appear


   , on right: 99 
                 100 
                 101 
                 239 
                 240 
                 241 
                 242 
                 243 
                 244 
                 253 
                 254 
                 255 
                 256 
                 257 
                 258 
                 259 
                 280 
                 282 
                 286 
assignment (148)
    on left: 66 67 68, on right: 6 59 156
assignment_id (147)
    on left: 65, on right: 66 67 68
bare_number (296)
    on left: 522 523 524, on right: 380 381 518
basic_music (194)
    on left: 207 208 209 210 211, on right: 212 218 220
bass_number (274)
    on left: 463 464 465 466, on right: 471
book_block (156)
    on left: 110, on right: 10 36 76
bookpart_block (159)
    on left: 124, on right: 11 37 77 114
br_bass_figure (278)
    on left: 479 480, on right: 482
braced_music_list (176)
    on left: 168, on right: 181 182 183 184
chord_body (244)
    on left: 391 392, on right: 390
chord_body_element (246)
    on left: 395 396 397, on right: 394
chord_body_elements (245)
    on left: 393 394, on right: 391 394
chord_item (288)
    on left: 501 502 503, on right: 496
chord_items (286)
    on left: 495 496, on right: 494 496
chord_separator (287)
    on left: 497 498 499 500, on right: 494 501
composite_music (197)
    on left: 218 219 220, on right: 14 105 116 129 179
context_change (224)
    on left: 335, on right: 188
context_def_spec_block (152)
    on left: 102, on right: 35 79 154
context_mod (231)
    on left: 356 357 358, on right: 107 200
context_mod_arg (153)
    on left: 103 105, on right: 109 202
context_modification_arg (188)
    on left: 194 195, on right: 193
context_modification_mods_list (190)
    on left: 197 198, on right: 196 198
context_prefix (192)
    on left: 203 204, on right: 215 216 217
context_prop_spec (234)
    on left: 362, on right: 93 98 366 367
contextable_music (195)
    on left: 212 213 214, on right: 215 216
contexted_basic_music (196)
    on left: 215 216 217, on right: 217 219
direction_less_event (253)
    on left: 415 416 417 418, on right: 404 409
direction_reqd_event (254)
    on left: 419 420, on right: 408
dots (271)
    on left: 456 457, on right: 252 453 454 457
embedded_lilypond (142)
    on left: 50 51 52 53 54 55 56 57, on right: 3 57
embedded_lilypond_number (141)
    on left: 47 48 49, on right: 47 52
embedded_scm_active (136)
    on left: 24 25 26, on right: 18 61 120 133 157
embedded_scm_arg (139)
    on left: 43 44 45, on right: 243 261 293 377
embedded_scm_bare (135)
    on left: 22 23, on right: 40 234 372 374 376 466
event_chord (242)
    on left: 385 386 387 388 389, on right: 186 214
event_function_event (248)
    on left: 401, on right: 418
exclamations (298)
    on left: 528 529, on right: 395 485 529
figure_list (279)
    on left: 481 482, on right: 392 482
figured_bass_alteration (275)
    on left: 467 468 469, on right: 473
figured_bass_modification (277)
    on left: 475 476 477 478, on right: 474
fingering (264)
    on left: 439, on right: 410 411 413
full_markup_list (300)
    on left: 533, on right: 16 31 86 118 131
function_arglist (209)
    on left: 280 281, on right: 46 318 401
function_arglist_skip_nonbackup (210)
    on left: 282 283, on right: 281 283
gen_text_def (263)
    on left: 436 437 438, on right: 419
grob_prop_path (233)
    on left: 360 361, on right: 92 97 364
grob_prop_spec (232)
    on left: 359, on right: 360 361
grouped_music_list (199)
    on left: 224 225, on right: 223 322 324 325
header_block (145)
    on left: 64, on right: 9 33 74
identifier_init (149)
    on left: 69 70 71 72 73, on right: 66 67 68
lilypond (132)
    on left: 4 5 6 7 8, on right: 1 5 6 7 8
lilypond_header (144)
    on left: 62, on right: 64 122 135 146
lilypond_header_body (143)
    on left: 58 59 60 61, on right: 59 60 61 62
lookup (134)
    on left: 20 21, on right: 26 39 42
lyric_element (283)
    on left: 489 490 491, on right: 492
lyric_element_music (284)
    on left: 492, on right: 170 175 250 298
lyric_mode_music (219)
    on left: 322 323, on right: 205 206 210 211
markup (323)
    on left: 574 575, on right: 552 559
markup_braced_list (312)
    on left: 550, on right: 544
markup_braced_list_body (313)
    on left: 551 552 553, on right: 550 552 553
markup_command_list (314)
    on left: 554, on right: 545
markup_composed_list (311)
    on left: 549, on right: 542
markup_head_1_item (319)
    on left: 566, on right: 567 568
markup_head_1_list (320)
    on left: 567 568, on right: 538 549 561 568 574
markup_list (308)
    on left: 542 543, on right: 533 537 553 555
markup_mode (302)
    on left: 534, on right: 535 536
markup_partial_function (317)
    on left: 560 561, on right: 536
markup_scm (306)
    on left: 541, on right: 546 573
markup_top (305)
    on left: 537 538 539, on right: 535
markup_uncomposed_list (309)
    on left: 544 545 546 548, on right: 543 549
maybe_notemode_duration (267)
    on left: 450 451, on right: 452 485 493
mode_changed_music (221)
    on left: 324 325, on right: 221
mode_changing_head (222)
    on left: 326 327 328 329 330, on right: 324
multiplied_duration (270)
    on left: 455, on right: 54 176 246 277 301 451
multipliers (272)
    on left: 458 459 460, on right: 252 455 459 460
music (177)
    on left: 169 170 171, on right: 141 173 180 181
music_assign (181)
    on left: 178 179, on right: 45 80 153 169
music_bare (198)
    on left: 221 222 223, on right: 209
music_embedded (179)
    on left: 173 174 175 176, on right: 55 166
music_embedded_backup (180)
    on left: 177, on right: 174 175
music_function_call (217)
    on left: 318, on right: 207 398 405
music_function_chord_body (247)
    on left: 398 399 400, on right: 397
music_list (175)
    on left: 165 166 167, on right: 55 166 167 168 185
music_or_context_def (171)
    on left: 153 154, on right: 160
music_property_def (236)
    on left: 364 365 366 367, on right: 187
new_chord (285)
    on left: 493 494, on right: 486
new_lyrics (193)
    on left: 205 206, on right: 206 215 220
note_chord_element (243)
    on left: 390, on right: 389
number_expression (292)
    on left: 511 512 513, on right: 70 511 512
number_factor (294)
    on left: 517 518, on right: 514 515 516 517
number_term (293)
    on left: 514 515 516, on right: 511 512 513
octave_check (255)
    on left: 421 422, on right: 395 485
optional_context_mods (189)
    on left: 196, on right: 203 204 205 206 325
optional_id (218)
    on left: 319 320, on right: 203 204
optional_rest (280)
    on left: 483 484, on right: 485
output_def (168)
    on left: 148, on right: 19 38 78 142 147
output_def_head (169)
    on left: 149 150 151, on right: 152
output_def_head_with_mode_switch (170)
    on left: 152, on right: 155
paper_block (167)
    on left: 147, on right: 113 127
partial_markup (304)
    on left: 536, on right: 30 85
pitch (261)
    on left: 432 433, on right: 254 263 305 434 485
pitch_as_music (178)
    on left: 172, on right: 171 213
pitch_or_music (281)
    on left: 485 486, on right: 81 172 245 275 299 378
pitch_or_tonic_pitch (262)
    on left: 434 435, on right: 395
post_event (251)
    on left: 412 413, on right: 53 403
property_operation (226)
    on left: 337 338 339 340, on right: 356
property_path (225)
    on left: 336, on right: 67 68 71 72 361 383 384
questions (299)
    on left: 530 531, on right: 395 485 531
quotes (256)
    on left: 423 424 425, on right: 422 430 431 433
reparsed_rhythm (206)
    on left: 252, on right: 247 278 302
repeated_music (182)
    on left: 180 181, on right: 208
revert_arg (227)
    on left: 341, on right: 339 340 365
revert_arg_backup (228)
    on left: 342, on right: 341 344 345 346
revert_arg_part (229)
    on left: 343 344 345 346, on right: 342
scm_function_call (140)
    on left: 46, on right: 25 41 44
score_block (162)
    on left: 137, on right: 13 34 75 115 128
score_body (163)
    on left: 138 139, on right: 137 139 548 571
score_item (164)
    on left: 140 141 142, on right: 144
score_items (165)
    on left: 143 144 146, on right: 138 144 146
script_dir (266)
    on left: 447 448 449, on right: 405 408 409
sequential_music (183)
    on left: 182 183, on right: 225
simple_element (282)
    on left: 487 488, on right: 385
simple_markup (321)
    on left: 569 571 572 573, on right: 538 539 574 575
simple_music (185)
    on left: 186 187 188, on right: 178
simple_revert_context (235)
    on left: 363, on right: 365
simple_string (239)
    on left: 373 374, on right: 180 181 210 211 320 335
simultaneous_music (184)
    on left: 184 185, on right: 224
start_symbol (130)
    on left: 1 3, on right: 0
steno_duration (269)
    on left: 453 454, on right: 162 163 455
steno_pitch (259)
    on left: 430, on right: 432
step_number (290)
    on left: 506 507 508, on right: 504 505
step_numbers (289)
    on left: 504 505, on right: 502 505
string (237)
    on left: 368 369, on right: 83 382
string_number_event (252)
    on left: 414, on right: 415
sub_quotes (258)
    on left: 428 429, on right: 424 429
sup_quotes (257)
    on left: 426 427, on right: 425 427
symbol (240)
    on left: 375 376, on right: 203 204 211 335 337 338
symbol_list_arg (200)
    on left: 226 227 228, on right: 251 279 303 341
symbol_list_element (203)
    on left: 233 234 235, on right: 232
symbol_list_part_bare (204)
    on left: 236 237, on right: 71 72 383 384
tempo_event (174)
    on left: 162 163 164, on right: 388
tempo_range (291)
    on left: 509 510, on right: 162 163
text (238)
    on left: 370 371 372, on right: 163 164
tremolo_type (273)
    on left: 461 462, on right: 417
unsigned_number (297)
    on left: 525 526 527, on right: 180 181 509 510

LilyPond — Contributor’s Guide v2.19.45 (development-branch).