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              | SYMBOL

   67 assignment: assignment_id '=' identifier_init
   68           | assignment_id '.' property_path '=' identifier_init
   69           | assignment_id ',' property_path '=' identifier_init
   70           | markup_mode_word '=' identifier_init

   71 identifier_init: identifier_init_nonumber
   72                | number_expression
   73                | symbol_list_part_bare '.' property_path
   74                | symbol_list_part_bare ',' property_path
   75                | post_event_nofinger post_events

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

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

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

  105 context_mod_arg: embedded_scm

  107 context_mod_arg:  composite_music

  108 context_def_spec_body: /* empty */
  109                      | context_def_spec_body context_mod
  110                      | context_def_spec_body context_modification
  111                      | context_def_spec_body context_mod_arg

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

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

  124 book_body: book_body  lilypond_header
  125          | book_body error

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

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

  137 bookpart_body: bookpart_body  lilypond_header
  138              | bookpart_body error

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

  140 score_body: score_items
  141           | score_body error

  142 score_item: embedded_scm
  143           | music
  144           | output_def

  145 score_items: /* empty */
  146            | score_items score_item

  148 score_items: score_items  lilypond_header

  149 paper_block: output_def

  150 output_def: output_def_body '}'

  151 output_def_head: "\paper"
  152                | "\midi"
  153                | "\layout"

  154 output_def_head_with_mode_switch: output_def_head

  155 music_or_context_def: music_assign
  156                     | context_def_spec_block

  157 output_def_body: output_def_head_with_mode_switch '{'
  158                | output_def_body assignment
  159                | output_def_body embedded_scm_active
  160                | output_def_body SCM_TOKEN

  162 output_def_body: output_def_body  music_or_context_def
  163                | output_def_body error

  164 tempo_event: "\tempo" steno_duration '=' tempo_range
  165            | "\tempo" text steno_duration '=' tempo_range
  166            | "\tempo" text

  167 music_list: /* empty */
  168           | music_list music_embedded
  169           | music_list error

  170 braced_music_list: '{' music_list '}'

  171 music: music_assign
  172      | lyric_element_music
  173      | pitch_as_music

  174 pitch_as_music: pitch_or_music

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

  179 music_embedded_backup: embedded_scm

  180 music_assign: simple_music
  181             | composite_music

  182 repeated_music: "\repeat" simple_string unsigned_number music
  183               | "\repeat" 
                        simple_string 
                        unsigned_number 
                        music 
                        "\alternative" 
                        braced_music_list 

  184 sequential_music: "\sequential" braced_music_list
  185                 | braced_music_list

  186 simultaneous_music: "\simultaneous" braced_music_list
  187                   | "<<" music_list ">>"

  188 simple_music: event_chord
  189             | music_property_def
  190             | context_change

  192 context_modification: "\with"  '{' context_mod_list '}'
  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_arg

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

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

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

  211 contextable_music: basic_music
  212                  | pitch_as_music
  213                  | event_chord

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

  217 composite_music: basic_music
  218                | contexted_basic_music
  219                | basic_music new_lyrics

  220 music_bare: mode_changed_music
  221           | MUSIC_IDENTIFIER
  222           | grouped_music_list

  223 grouped_music_list: simultaneous_music
  224                   | sequential_music

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

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

  231 symbol_list_part: symbol_list_part_bare
  232                 | embedded_scm_bare

  233 symbol_list_element: STRING
  234                    | UNSIGNED

  235 symbol_list_part_bare: SYMBOL
  236                      | symbol_list_element

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

  251 reparsed_rhythm: DURATION_ARG dots multipliers post_events

  252 function_arglist_nonbackup_reparse: "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            SCM_IDENTIFIER 
  253                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            pitch 
  254                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            steno_tonic_pitch 
  255                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            STRING 
  256                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist_nonbackup 
                                            SYMBOL 
  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                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 SYMBOL 
  276                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 pitch_or_music 
  277                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 bare_number_common 
  278                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 multiplied_duration 
  279                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 reparsed_rhythm 
  280                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 symbol_list_arg 

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

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

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

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

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

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

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

  318 function_arglist_skip_backup: function_arglist_backup
  319                             | "optional?" 
                                      "scheme?" 
                                      function_arglist_skip_backup 

  320 music_function_call: MUSIC_FUNCTION function_arglist

  321 optional_id: /* empty */
  322            | '=' simple_string

  324 lyric_mode_music:  grouped_music_list
  325                 | MUSIC_IDENTIFIER

  326 mode_changed_music: mode_changing_head grouped_music_list
  327                   | mode_changing_head_with_context 
                            optional_context_mods 
                            grouped_music_list 

  328 mode_changing_head: "\notemode"
  329                   | "\drummode"
  330                   | "\figuremode"
  331                   | "\chordmode"
  332                   | "\lyricmode"

  333 mode_changing_head_with_context: "\drums"
  334                                | "\figures"
  335                                | "\chords"
  336                                | "\lyrics"

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

  338 property_path: symbol_list_rev

  339 property_operation: symbol '=' scalar
  340                   | "\unset" symbol
  341                   | "\override" revert_arg '=' scalar
  342                   | "\revert" revert_arg

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

  344 revert_arg_backup: revert_arg_part

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

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

  358 context_mod: property_operation
  359            | context_def_mod STRING
  360            | context_def_mod SYMBOL
  361            | context_def_mod embedded_scm

  362 grob_prop_spec: symbol_list_rev

  363 grob_prop_path: grob_prop_spec
  364               | grob_prop_spec property_path

  365 context_prop_spec: symbol_list_rev

  366 simple_revert_context: symbol_list_part

  367 music_property_def: "\override" grob_prop_path '=' scalar
  368                   | "\revert" simple_revert_context revert_arg
  369                   | "\set" context_prop_spec '=' scalar
  370                   | "\unset" context_prop_spec

  371 string: STRING
  372       | SYMBOL
  373       | full_markup

  374 text: STRING
  375     | SYMBOL
  376     | full_markup
  377     | embedded_scm_bare

  378 simple_string: STRING
  379              | SYMBOL
  380              | embedded_scm_bare

  381 symbol: STRING
  382       | SYMBOL
  383       | embedded_scm_bare

  384 scalar: embedded_scm_arg
  385       | pitch_or_music
  386       | SCM_IDENTIFIER
  387       | bare_number
  388       | '-' bare_number
  389       | string
  390       | symbol_list_part_bare '.' property_path
  391       | symbol_list_part_bare ',' property_path

  392 event_chord: simple_element post_events
  393            | CHORD_REPETITION optional_notemode_duration post_events
  394            | MULTI_MEASURE_REST optional_notemode_duration post_events
  395            | tempo_event
  396            | note_chord_element

  397 note_chord_element: chord_body optional_notemode_duration post_events

  398 chord_body: "<" chord_body_elements ">"
  399           | FIGURE_OPEN figure_list FIGURE_CLOSE

  400 chord_body_elements: /* empty */
  401                    | chord_body_elements chord_body_element

  402 chord_body_element: pitch_or_tonic_pitch 
                            exclamations 
                            questions 
                            octave_check 
                            post_events 
  403                   | DRUM_PITCH post_events
  404                   | music_function_chord_body

  405 music_function_chord_body: music_function_call
  406                          | MUSIC_IDENTIFIER
  407                          | embedded_scm

  408 event_function_event: EVENT_FUNCTION function_arglist

  409 post_events: /* empty */
  410            | post_events post_event

  411 post_event_nofinger: direction_less_event
  412                    | script_dir music_function_call
  413                    | "--"
  414                    | "__"
  415                    | script_dir direction_reqd_event
  416                    | script_dir direction_less_event
  417                    | '^' fingering
  418                    | '_' fingering

  419 post_event: post_event_nofinger
  420           | '-' fingering

  421 string_number_event: E_UNSIGNED

  422 direction_less_event: string_number_event
  423                     | EVENT_IDENTIFIER
  424                     | tremolo_type
  425                     | event_function_event

  426 direction_reqd_event: gen_text_def
  427                     | script_abbreviation

  428 octave_check: /* empty */
  429             | '=' quotes

  430 quotes: /* empty */
  431       | sub_quotes
  432       | sup_quotes

  433 sup_quotes: '''
  434           | sup_quotes '''

  435 sub_quotes: ','
  436           | sub_quotes ','

  437 steno_pitch: NOTENAME_PITCH quotes

  438 steno_tonic_pitch: TONICNAME_PITCH quotes

  439 pitch: steno_pitch
  440      | PITCH_IDENTIFIER quotes

  441 pitch_or_tonic_pitch: pitch
  442                     | steno_tonic_pitch

  443 gen_text_def: full_markup
  444             | STRING
  445             | SYMBOL
  446             | embedded_scm

  447 fingering: UNSIGNED

  448 script_abbreviation: '^'
  449                    | '+'
  450                    | '-'
  451                    | '!'
  452                    | ">"
  453                    | '.'
  454                    | '_'

  455 script_dir: '_'
  456           | '^'
  457           | '-'

  458 maybe_notemode_duration: /* empty */
  459                        | multiplied_duration

  460 optional_notemode_duration: maybe_notemode_duration

  461 steno_duration: UNSIGNED dots
  462               | DURATION_IDENTIFIER dots

  463 multiplied_duration: steno_duration multipliers

  464 dots: /* empty */
  465     | dots '.'

  466 multipliers: /* empty */
  467            | multipliers '*' UNSIGNED
  468            | multipliers '*' FRACTION

  469 tremolo_type: ':'
  470             | ':' UNSIGNED

  471 bass_number: UNSIGNED
  472            | STRING
  473            | SYMBOL
  474            | full_markup
  475            | embedded_scm_bare

  476 figured_bass_alteration: '-'
  477                        | '+'
  478                        | '!'

  479 bass_figure: "_"
  480            | bass_number
  481            | bass_figure ']'
  482            | bass_figure figured_bass_alteration
  483            | bass_figure figured_bass_modification

  484 figured_bass_modification: "\+"
  485                          | "\!"
  486                          | '/'
  487                          | "\"

  488 br_bass_figure: bass_figure
  489               | '[' bass_figure

  490 figure_list: /* empty */
  491            | figure_list br_bass_figure

  492 optional_rest: /* empty */
  493              | "\rest"

  494 pitch_or_music: pitch 
                        exclamations 
                        questions 
                        octave_check 
                        maybe_notemode_duration 
                        optional_rest 
                        post_events 
  495               | new_chord post_events

  496 simple_element: DRUM_PITCH optional_notemode_duration
  497               | RESTNAME optional_notemode_duration

  498 lyric_element: full_markup
  499              | SYMBOL
  500              | STRING
  501              | LYRIC_ELEMENT

  502 lyric_element_music: lyric_element 
                             optional_notemode_duration 
                             post_events 

  503 new_chord: steno_tonic_pitch maybe_notemode_duration
  504          | steno_tonic_pitch 
                   optional_notemode_duration 
                   chord_separator 
                   chord_items 

  505 chord_items: /* empty */
  506            | chord_items chord_item

  507 chord_separator: ":"
  508                | "^"
  509                | "/" steno_tonic_pitch
  510                | "/+" steno_tonic_pitch

  511 chord_item: chord_separator
  512           | step_numbers
  513           | CHORD_MODIFIER

  514 step_numbers: step_number
  515             | step_numbers '.' step_number

  516 step_number: UNSIGNED
  517            | UNSIGNED '+'
  518            | UNSIGNED "-"

  519 tempo_range: unsigned_number
  520            | unsigned_number '-' unsigned_number

  521 number_expression: number_expression '+' number_term
  522                  | number_expression '-' number_term
  523                  | number_term

  524 number_term: number_factor
  525            | number_factor '*' number_factor
  526            | number_factor '/' number_factor

  527 number_factor: '-' number_factor
  528              | bare_number

  529 bare_number_common: REAL
  530                   | NUMBER_IDENTIFIER
  531                   | REAL NUMBER_IDENTIFIER

  532 bare_number: bare_number_common
  533            | UNSIGNED
  534            | UNSIGNED NUMBER_IDENTIFIER

  535 unsigned_number: UNSIGNED
  536                | NUMBER_IDENTIFIER
  537                | embedded_scm

  538 exclamations: /* empty */
  539             | exclamations '!'

  540 questions: /* empty */
  541          | questions '?'

  543 full_markup_list: "\markuplist" 0 markup_list

  544 markup_mode: "\markup"

  545 markup_mode_word: markup_mode markup_word

  546 full_markup: markup_mode markup_top
  547            | markup_mode_word

  548 partial_markup: markup_mode markup_partial_function "\etc"

  549 markup_top: markup_list
  550           | markup_head_1_list simple_markup
  551           | simple_markup_noword

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

  554 markup_list: markup_composed_list
  555            | markup_uncomposed_list

  556 markup_uncomposed_list: markup_braced_list
  557                       | markup_command_list
  558                       | markup_scm MARKUPLIST_IDENTIFIER

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

  561 markup_composed_list: markup_head_1_list markup_uncomposed_list

  562 markup_braced_list: '{' markup_braced_list_body '}'

  563 markup_braced_list_body: /* empty */
  564                        | markup_braced_list_body markup
  565                        | markup_braced_list_body markup_list

  566 markup_command_list: MARKUP_LIST_FUNCTION markup_command_list_arguments

  567 markup_command_basic_arguments: "markup-list?" 
                                        markup_command_list_arguments 
                                        markup_list 
  568                               | "scheme?" 
                                        markup_command_list_arguments 
                                        embedded_scm 
  569                               | EXPECT_NO_MORE_ARGS

  570 markup_command_list_arguments: markup_command_basic_arguments
  571                              | "markup?" 
                                       markup_command_list_arguments 
                                       markup 

  572 markup_partial_function: MARKUP_FUNCTION markup_arglist_partial
  573                        | markup_head_1_list 
                                 MARKUP_FUNCTION 
                                 markup_arglist_partial 

  574 markup_arglist_partial: "markup?" markup_arglist_partial
  575                       | "scheme?" markup_arglist_partial
  576                       | "markup?" markup_command_list_arguments
  577                       | "scheme?" markup_command_list_arguments

  578 markup_head_1_item: MARKUP_FUNCTION 
                            "markup?" 
                            markup_command_list_arguments 

  579 markup_head_1_list: markup_head_1_item
  580                   | markup_head_1_list markup_head_1_item

  581 markup_word: STRING
  582            | SYMBOL

  583 simple_markup: markup_word
  584              | simple_markup_noword

  586 simple_markup_noword: "\score" 3 '{' score_body '}'
  587                     | MARKUP_FUNCTION markup_command_basic_arguments
  588                     | markup_scm MARKUP_IDENTIFIER

  589 markup: markup_head_1_list simple_markup
  590       | simple_markup


Terminals, with rules where they appear



    254 255 256 257 258 259 261 262 263 264 265 266 267 268 269 270
    256 257 258 259 261 262 263 264 265 266 267 268 269 270 271 272
    271 272 273 274 275 282 284 285 286 287 288 289 290 291 292 294
    273 274 275 282 284 287 288 291 292 316 319
    295 296 297 305 306 307 308 309 310 311 312 313 314 316 319 568
    298 299 300 301 302 303 304
    429
    517 518 533 534 535
    520 522 527
    575 577
"#{" (340) 3
"(backed-up?)" (335) 177 317 343 346 347 348 553
"(reparsed?)" (336) 244 245 246 247 248 249 250 276 277 278 279 280
"-" (320) 518
"--" (265) 413
"/" (321) 509
"/+" (317) 510
":" (319) 507
"<" (322) 398
"<<" (324) 187
">" (323) 398 452
">>" (325) 187
"\!" (327) 485
"\" (326) 487
"\+" (328) 484
"\accepts" (273) 351
"\addlyrics" (262) 204 205
"\alias" (274) 354
"\alternative" (260) 183
"\book" (275) 112
"\bookpart" (276) 126
"\change" (277) 337
"\chordmode" (278) 331
"\chords" (279) 335
"\consists" (280) 349
"\context" (281) 104 202
"\default" (282) 282 316
"\defaultchild" (283) 352
"\denies" (284) 353
"\description" (285) 356
"\drummode" (286) 329
"\drums" (287) 333
"\etc" (288) 90 548
"\figuremode" (289) 330
"\figures" (290) 334
"\header" (291) 62
"\layout" (293) 153
"\lyricmode" (294) 332
"\lyrics" (295) 336
"\lyricsto" (296) 209 210
"\markup" (297) 544
"\markuplist" (298) 543
"\midi" (299) 152
"\name" (300) 357
"\new" (316) 203
"\notemode" (301) 328
"\override" (302) 94 99 341 367
"\paper" (303) 151
"\remove" (304) 350
"\repeat" (259) 182 183
"\rest" (305) 493
"\revert" (306) 342 368
"\score" (307) 139 586
"\score-lines" (308) 560
"\sequential" (309) 184
"\set" (310) 95 100 369
"\simultaneous" (311) 186
"\tempo" (312) 164 165 166
"\type" (313) 355
"\unset" (314) 340 370
"\version-error" (292) 8 57
"\with" (315) 192 193
"^" (318) 508
"_" (331) 479
"__" (264) 414
"end of input" (0) 0
"markup-list?" (337) 567
"markup?" (333) 571 574 576 578
"optional?" (338) 101 102 103 238 239 240 241 242 243 252 253 254 255
"scheme?" (334) 96 97 98 101 102 103 238 239 240 241 242 243 252 253
'!' (33) 451 478 539
''' (39) 433 434
'*' (42) 467 468 525
'+' (43) 449 477 517 521
',' (44) 69 74 227 230 347 391 435 436
'-' (45) 47 239 240 241 269 270 271 297 313 314 388 420 450 457 476
'.' (46) 21 68 73 226 229 346 390 453 465 515
'/' (47) 486 526
':' (58) 469 470
'=' (61) 67 68 69 70 94 95 99 100 164 165 210 322 337 339 341 367 369
'?' (63) 541
'[' (91) 489
']' (93) 481
'^' (94) 417 448 456
'_' (95) 418 454 455
'{' (123) 62 104 112 126 139 157 170 192 560 562 586
'}' (125) 62 104 112 126 139 150 170 192 560 562 586
BOOK_IDENTIFIER (341) 12 114 128
CHORD_MODIFIER (342) 513
CHORD_REPETITION (343) 393
COMPOSITE (261)
DRUM_PITCH (344) 403 496
DURATION_ARG (345) 251
DURATION_IDENTIFIER (263) 259 272 312 462
E_UNSIGNED (268) 421
error (256) 7 56 125 138 141 163 169
EVENT_FUNCTION (266) 92 97 102 408
EVENT_IDENTIFIER (267) 423
EXPECT_NO_MORE_ARGS (339) 293 569
FIGURE_CLOSE (329) 399
FIGURE_OPEN (330) 399
FRACTION (346) 29 84 468
LOOKUP_IDENTIFIER (347) 20 21
LYRIC_ELEMENT (348) 501
MARKUP_FUNCTION (349) 572 573 578 587
MARKUP_IDENTIFIER (351) 588
MARKUP_LIST_FUNCTION (350) 566
MARKUPLIST_IDENTIFIER (352) 558
MULTI_MEASURE_REST (332) 394
MUSIC_FUNCTION (353) 91 96 101 320
MUSIC_IDENTIFIER (354) 195 221 325 406
NOTENAME_PITCH (355) 437
NUMBER_IDENTIFIER (271) 49 241 268 271 297 530 531 534 536
PITCH_IDENTIFIER (356) 440
PREC_BOT (258)
PREC_TOP (272)
REAL (269) 240 267 270 314 529 531
RESTNAME (357) 497
SCM_ARG (358) 27 248 298 346 347 348
SCM_FUNCTION (359) 46 93 98 103
SCM_IDENTIFIER (360) 23 24 252 273 305 386
SCM_TOKEN (361) 17 22 28 60 121 134 160
STRING (362) 65 233 255 274 308 359 371 374 378 381 444 472 500 581
SYMBOL (365) 66 235 256 275 309 360 372 375 379 382 445 473 499 582
SYMBOL_LIST (363) 225 226 227
TONICNAME_PITCH (364) 438
UNARY_MINUS (366)
UNSIGNED (270) 49 234 239 258 266 269 311 313 447 461 467 470 471 516

Nonterminals, with rules where they appear


   , on right: 101 
                 102 
                 103 
                 238 
                 239 
                 240 
                 241 
                 242 
                 243 
                 252 
                 253 
                 254 
                 255 
                 256 
                 257 
                 258 
                 259 
                 281 
                 283 
                 287 
assignment (148)
    on left: 67 68 69 70, on right: 6 59 158
assignment_id (147)
    on left: 65 66, on right: 67 68 69
bare_number (296)
    on left: 532 533 534, on right: 387 388 528
basic_music (194)
    on left: 206 207 208 209 210, on right: 211 217 219
bass_number (274)
    on left: 471 472 473 474 475, on right: 480
book_block (156)
    on left: 112, on right: 10 36 78
bookpart_block (159)
    on left: 126, on right: 11 37 79 116
br_bass_figure (278)
    on left: 488 489, on right: 491
braced_music_list (176)
    on left: 170, on right: 183 184 185 186
chord_body (244)
    on left: 398 399, on right: 397
chord_body_element (246)
    on left: 402 403 404, on right: 401
chord_body_elements (245)
    on left: 400 401, on right: 398 401
chord_item (288)
    on left: 511 512 513, on right: 506
chord_items (286)
    on left: 505 506, on right: 504 506
chord_separator (287)
    on left: 507 508 509 510, on right: 504 511
composite_music (197)
    on left: 217 218 219, on right: 14 107 118 131 181
context_change (224)
    on left: 337, on right: 190
context_def_spec_block (152)
    on left: 104, on right: 35 81 156
context_mod (231)
    on left: 358 359 360 361, on right: 109 200
context_mod_arg (153)
    on left: 105 107, on right: 111 201
context_mod_list (191)
    on left: 199 200 201, on right: 192 200 201
context_modification (186)
    on left: 192 193, on right: 32 89 110 198
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: 202 203, on right: 214 215 216
context_prop_spec (234)
    on left: 365, on right: 95 100 369 370
contextable_music (195)
    on left: 211 212 213, on right: 214 215
contexted_basic_music (196)
    on left: 214 215 216, on right: 216 218
direction_less_event (253)
    on left: 422 423 424 425, on right: 411 416
direction_reqd_event (254)
    on left: 426 427, on right: 415
dots (271)
    on left: 464 465, on right: 251 461 462 465
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 122 135 159
embedded_scm_arg (139)
    on left: 43 44 45, on right: 242 261 294 384
embedded_scm_bare (135)
    on left: 22 23, on right: 40 232 377 380 383 475
event_chord (242)
    on left: 392 393 394 395 396, on right: 188 213
event_function_event (248)
    on left: 408, on right: 425
exclamations (298)
    on left: 538 539, on right: 402 494 539
figure_list (279)
    on left: 490 491, on right: 399 491
figured_bass_alteration (275)
    on left: 476 477 478, on right: 482
figured_bass_modification (277)
    on left: 484 485 486 487, on right: 483
fingering (264)
    on left: 447, on right: 417 418 420
full_markup_list (300)
    on left: 543, on right: 16 31 88 120 133
function_arglist (209)
    on left: 281 282, on right: 46 320 408
function_arglist_skip_nonbackup (210)
    on left: 283 284, on right: 282 284
gen_text_def (263)
    on left: 443 444 445 446, on right: 426
grob_prop_path (233)
    on left: 363 364, on right: 94 99 367
grob_prop_spec (232)
    on left: 362, on right: 363 364
grouped_music_list (199)
    on left: 223 224, on right: 222 324 326 327
header_block (145)
    on left: 64, on right: 9 33 76
identifier_init (149)
    on left: 71 72 73 74 75, on right: 67 68 69 70
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 124 137 148
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: 498 499 500 501, on right: 502
lyric_element_music (284)
    on left: 502, on right: 172 177 249 299
lyric_mode_music (219)
    on left: 324 325, on right: 204 205 209 210
markup (326)
    on left: 589 590, on right: 564 571
markup_braced_list (313)
    on left: 562, on right: 556
markup_braced_list_body (314)
    on left: 563 564 565, on right: 562 564 565
markup_command_list (315)
    on left: 566, on right: 557
markup_composed_list (312)
    on left: 561, on right: 554
markup_head_1_item (320)
    on left: 578, on right: 579 580
markup_head_1_list (321)
    on left: 579 580, on right: 550 561 573 580 589
markup_list (309)
    on left: 554 555, on right: 543 549 565 567
markup_mode (302)
    on left: 544, on right: 545 546 548
markup_mode_word (303)
    on left: 545, on right: 70 547
markup_partial_function (318)
    on left: 572 573, on right: 548
markup_scm (307)
    on left: 553, on right: 558 588
markup_top (306)
    on left: 549 550 551, on right: 546
markup_uncomposed_list (310)
    on left: 556 557 558 560, on right: 555 561
markup_word (322)
    on left: 581 582, on right: 545 583
maybe_notemode_duration (267)
    on left: 458 459, on right: 460 494 503
mode_changed_music (221)
    on left: 326 327, on right: 220
mode_changing_head (222)
    on left: 328 329 330 331 332, on right: 326
multiplied_duration (270)
    on left: 463, on right: 54 178 245 278 302 459
multipliers (272)
    on left: 466 467 468, on right: 251 463 467 468
music (177)
    on left: 171 172 173, on right: 143 175 182 183
music_assign (181)
    on left: 180 181, on right: 45 82 155 171
music_bare (198)
    on left: 220 221 222, on right: 208
music_embedded (179)
    on left: 175 176 177 178, on right: 55 168
music_embedded_backup (180)
    on left: 179, on right: 176 177
music_function_call (217)
    on left: 320, on right: 206 405 412
music_function_chord_body (247)
    on left: 405 406 407, on right: 404
music_list (175)
    on left: 167 168 169, on right: 55 168 169 170 187
music_or_context_def (171)
    on left: 155 156, on right: 162
music_property_def (236)
    on left: 367 368 369 370, on right: 189
new_chord (285)
    on left: 503 504, on right: 495
new_lyrics (193)
    on left: 204 205, on right: 205 214 219
note_chord_element (243)
    on left: 397, on right: 396
number_expression (292)
    on left: 521 522 523, on right: 72 521 522
number_factor (294)
    on left: 527 528, on right: 524 525 526 527
number_term (293)
    on left: 524 525 526, on right: 521 522 523
octave_check (255)
    on left: 428 429, on right: 402 494
optional_context_mods (189)
    on left: 196, on right: 202 203 204 205 327
optional_id (218)
    on left: 321 322, on right: 202 203
optional_rest (280)
    on left: 492 493, on right: 494
output_def (168)
    on left: 150, on right: 19 38 80 144 149
output_def_head (169)
    on left: 151 152 153, on right: 154
output_def_head_with_mode_switch (170)
    on left: 154, on right: 157
paper_block (167)
    on left: 149, on right: 115 129
partial_markup (305)
    on left: 548, on right: 30 87
pitch (261)
    on left: 439 440, on right: 253 263 306 441 494
pitch_as_music (178)
    on left: 174, on right: 173 212
pitch_or_music (281)
    on left: 494 495, on right: 83 174 244 276 300 385
pitch_or_tonic_pitch (262)
    on left: 441 442, on right: 402
post_event (251)
    on left: 419 420, on right: 53 410
property_operation (226)
    on left: 339 340 341 342, on right: 358
property_path (225)
    on left: 338, on right: 68 69 73 74 364 390 391
questions (299)
    on left: 540 541, on right: 402 494 541
quotes (256)
    on left: 430 431 432, on right: 429 437 438 440
reparsed_rhythm (206)
    on left: 251, on right: 246 279 303
repeated_music (182)
    on left: 182 183, on right: 207
revert_arg (227)
    on left: 343, on right: 341 342 368
revert_arg_backup (228)
    on left: 344, on right: 343 346 347 348
revert_arg_part (229)
    on left: 345 346 347 348, on right: 344
scm_function_call (140)
    on left: 46, on right: 25 41 44
score_block (162)
    on left: 139, on right: 13 34 77 117 130
score_body (163)
    on left: 140 141, on right: 139 141 560 586
score_item (164)
    on left: 142 143 144, on right: 146
score_items (165)
    on left: 145 146 148, on right: 140 146 148
script_dir (266)
    on left: 455 456 457, on right: 412 415 416
sequential_music (183)
    on left: 184 185, on right: 224
simple_element (282)
    on left: 496 497, on right: 392
simple_markup (323)
    on left: 583 584, on right: 550 589 590
simple_markup_noword (324)
    on left: 586 587 588, on right: 551 584
simple_music (185)
    on left: 188 189 190, on right: 180
simple_revert_context (235)
    on left: 366, on right: 368
simultaneous_music (184)
    on left: 186 187, on right: 223
start_symbol (130)
    on left: 1 3, on right: 0
steno_duration (269)
    on left: 461 462, on right: 164 165 463
steno_pitch (259)
    on left: 437, on right: 439
step_number (290)
    on left: 516 517 518, on right: 514 515
step_numbers (289)
    on left: 514 515, on right: 512 515
string (237)
    on left: 371 372 373, on right: 85 389
string_number_event (252)
    on left: 421, on right: 422
sub_quotes (258)
    on left: 435 436, on right: 431 436
sup_quotes (257)
    on left: 433 434, on right: 432 434
symbol (240)
    on left: 381 382 383, on right: 202 203 210 337 339 340
symbol_list_arg (200)
    on left: 225 226 227, on right: 250 280 304 343
symbol_list_element (203)
    on left: 233 234, on right: 236
symbol_list_part_bare (204)
    on left: 235 236, on right: 73 74 231 390 391
tempo_event (174)
    on left: 164 165 166, on right: 395
tempo_range (291)
    on left: 519 520, on right: 164 165
text (238)
    on left: 374 375 376 377, on right: 165 166
tremolo_type (273)
    on left: 469 470, on right: 424
unsigned_number (297)
    on left: 535 536 537, on right: 182 183 519 520

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