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"

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

   20 embedded_scm_bare: SCM_TOKEN
   21                  | SCM_IDENTIFIER

   22 embedded_scm_active: SCM_IDENTIFIER
   23                    | scm_function_call

   24 embedded_scm_bare_arg: SCM_ARG
   25                      | SCM_TOKEN
   26                      | full_markup_list
   27                      | context_modification
   28                      | score_block
   29                      | context_def_spec_block
   30                      | book_block
   31                      | bookpart_block
   32                      | output_def

   33 embedded_scm: embedded_scm_bare
   34             | scm_function_call

   35 embedded_scm_arg: embedded_scm_bare_arg
   36                 | scm_function_call
   37                 | music_arg

   38 scm_function_call: SCM_FUNCTION function_arglist

   39 embedded_lilypond: /* empty */
   40                  | identifier_init
   41                  | music_embedded music_embedded music_list
   42                  | error
   43                  | "\version-error" embedded_lilypond

   44 lilypond_header_body: /* empty */
   45                     | lilypond_header_body assignment
   46                     | lilypond_header_body embedded_scm

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

   48 assignment_id: STRING

   49 assignment: assignment_id '=' identifier_init
   50           | assignment_id property_path '=' identifier_init

   51 identifier_init: score_block
   52                | book_block
   53                | bookpart_block
   54                | output_def
   55                | context_def_spec_block
   56                | music_assign
   57                | post_event_nofinger post_events
   58                | number_expression
   59                | FRACTION
   60                | string
   61                | embedded_scm
   62                | full_markup_list
   63                | context_modification

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

   65 context_mod_arg: embedded_scm
   66                | composite_music

   67 context_mod_embedded: context_mod_arg

   68 context_def_spec_body: /* empty */
   69                      | CONTEXT_DEF_IDENTIFIER
   70                      | context_def_spec_body context_mod
   71                      | context_def_spec_body context_modification
   72                      | context_def_spec_body context_mod_embedded

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

   74 book_body: /* empty */
   75          | BOOK_IDENTIFIER
   76          | book_body paper_block
   77          | book_body bookpart_block
   78          | book_body score_block
   79          | book_body composite_music
   80          | book_body full_markup
   81          | book_body full_markup_list
   82          | book_body SCM_TOKEN
   83          | book_body embedded_scm_active

   85 book_body: book_body  lilypond_header
   86          | book_body error

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

   88 bookpart_body: /* empty */
   89              | BOOK_IDENTIFIER
   90              | bookpart_body paper_block
   91              | bookpart_body score_block
   92              | bookpart_body composite_music
   93              | bookpart_body full_markup
   94              | bookpart_body full_markup_list
   95              | bookpart_body SCM_TOKEN
   96              | bookpart_body embedded_scm_active

   98 bookpart_body: bookpart_body  lilypond_header
   99              | bookpart_body error

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

  101 score_body: music
  102           | embedded_scm_active

  104 score_body: score_body  lilypond_header
  105           | score_body output_def
  106           | score_body error

  107 paper_block: output_def

  108 output_def: output_def_body '}'

  109 output_def_head: "\paper"
  110                | "\midi"
  111                | "\layout"

  112 output_def_head_with_mode_switch: output_def_head

  113 music_or_context_def: music_arg

  115 music_or_context_def: "\context"  '{' context_def_spec_body '}'

  116 output_def_body: output_def_head_with_mode_switch '{'
  117                | output_def_head_with_mode_switch 
                         '{' 
                         OUTPUT_DEF_IDENTIFIER 
  118                | output_def_body assignment
  119                | output_def_body embedded_scm

  121 output_def_body: output_def_body  music_or_context_def
  122                | output_def_body error

  123 tempo_event: "\tempo" steno_duration '=' tempo_range
  124            | "\tempo" scalar_closed steno_duration '=' tempo_range
  125            | "\tempo" scalar

  126 music_list: /* empty */
  127           | music_list music_embedded
  128           | music_list error

  129 braced_music_list: '{' music_list '}'

  130 music: music_arg
  131      | lyric_element_music

  132 music_embedded: music
  133               | music_embedded_backup "(backed-up?)" SCM_ARG
  134               | music_embedded_backup 
                        "(backed-up?)" 
                        lyric_element_music 

  135 music_embedded_backup: embedded_scm_closed

  136 music_arg: simple_music
  137          | composite_music

  138 music_assign: simple_music
  139             | composite_music

  140 repeated_music: "\repeat" simple_string unsigned_number music
  141               | "\repeat" 
                        simple_string 
                        unsigned_number 
                        music 
                        "\alternative" 
                        braced_music_list 

  142 sequential_music: "\sequential" braced_music_list
  143                 | braced_music_list

  144 simultaneous_music: "\simultaneous" braced_music_list
  145                   | "<<" music_list ">>"

  146 simple_music: event_chord
  147             | music_property_def
  148             | context_change

  150 context_modification: "\with"  '{' context_mod_list '}'
  151                     | "\with" CONTEXT_MOD_IDENTIFIER
  152                     | CONTEXT_MOD_IDENTIFIER
  153                     | "\with" embedded_scm_closed

  154 optional_context_mod: /* empty */
  155                     | context_modification

  156 context_mod_list: /* empty */
  157                 | context_mod_list context_mod
  158                 | context_mod_list CONTEXT_MOD_IDENTIFIER
  159                 | context_mod_list context_mod_embedded

  160 composite_music: complex_music
  161                | music_bare

  162 closed_music: music_bare
  163             | complex_music_prefix closed_music
  164             | music_function_call_closed

  165 music_bare: mode_changed_music
  166           | MUSIC_IDENTIFIER
  167           | grouped_music_list

  168 grouped_music_list: simultaneous_music
  169                   | sequential_music

  170 function_arglist_skip: function_arglist_common
  171                      | "optional?" "ly:pitch?" function_arglist_skip
  172                      | "optional?" "ly:duration?" function_arglist_skip
  173                      | "optional?" "scheme?" function_arglist_skip

  174 function_arglist_nonbackup_common: "optional?" 
                                           "ly:pitch?" 
                                           function_arglist 
                                           pitch_also_in_chords 
  175                                  | "optional?" 
                                           "ly:duration?" 
                                           function_arglist_closed 
                                           duration_length 
  176                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist 
                                           FRACTION 
  177                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist_closed 
                                           post_event_nofinger 
  178                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist_closed 
                                           '-' 
                                           UNSIGNED 
  179                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist_closed 
                                           '-' 
                                           REAL 
  180                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist_closed 
                                           '-' 
                                           NUMBER_IDENTIFIER 

  181 function_arglist_closed_nonbackup: function_arglist_nonbackup_common
  182                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist 
                                           embedded_scm_arg_closed 
  183                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist_closed 
                                           bare_number_closed 
  184                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist 
                                           SCM_IDENTIFIER 
  185                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist 
                                           STRING 
  186                                  | "optional?" 
                                           "scheme?" 
                                           function_arglist 
                                           full_markup 

  187 symbol_list_arg: SYMBOL_LIST
  188                | SYMBOL_LIST '.' symbol_list_rev

  189 symbol_list_rev: symbol_list_part
  190                | symbol_list_rev '.' symbol_list_part

  191 symbol_list_part: symbol_list_element

  192 symbol_list_element: STRING
  193                    | embedded_scm_bare

  194 function_arglist_nonbackup: function_arglist_nonbackup_common
  195                           | "optional?" 
                                    "scheme?" 
                                    function_arglist 
                                    embedded_scm_arg 
  196                           | "optional?" 
                                    "scheme?" 
                                    function_arglist_closed 
                                    bare_number 
  197                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    SCM_ARG 
  198                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    lyric_element_music 
  199                           | function_arglist_nonbackup_reparse 
                                    "(reparsed?)" 
                                    symbol_list_arg 

  200 function_arglist_nonbackup_reparse: "optional?" 
                                            "scheme?" 
                                            function_arglist 
                                            SCM_IDENTIFIER 
  201                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist 
                                            STRING 
  202                                   | "optional?" 
                                            "scheme?" 
                                            function_arglist 
                                            full_markup 

  203 function_arglist_keep: function_arglist_common
  204                      | function_arglist_backup

  205 function_arglist_closed_keep: function_arglist_closed_common
  206                             | function_arglist_backup

  207 function_arglist_backup: "optional?" 
                                 "scheme?" 
                                 function_arglist_keep 
                                 embedded_scm_arg_closed 
  208                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_closed_keep 
                                 post_event_nofinger 
  209                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_keep 
                                 full_markup 
  210                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_closed_keep 
                                 UNSIGNED 
  211                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_closed_keep 
                                 REAL 
  212                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_closed_keep 
                                 NUMBER_IDENTIFIER 
  213                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_keep 
                                 FRACTION 
  214                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_closed_keep 
                                 '-' 
                                 UNSIGNED 
  215                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_closed_keep 
                                 '-' 
                                 REAL 
  216                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_closed_keep 
                                 '-' 
                                 NUMBER_IDENTIFIER 
  217                        | "optional?" 
                                 "ly:pitch?" 
                                 function_arglist_keep 
                                 pitch_also_in_chords 
  218                        | "optional?" 
                                 "ly:duration?" 
                                 function_arglist_closed_keep 
                                 duration_length 
  219                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_keep 
                                 SCM_IDENTIFIER 
  220                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_keep 
                                 STRING 
  221                        | "optional?" 
                                 "scheme?" 
                                 function_arglist_backup 
                                 "(backed-up?)" 
  222                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 bare_number 
  223                        | function_arglist_backup 
                                 "(reparsed?)" 
                                 symbol_list_arg 

  224 function_arglist: function_arglist_common
  225                 | function_arglist_nonbackup

  226 function_arglist_common: function_arglist_bare
  227                        | "scheme?" 
                                 function_arglist_optional 
                                 embedded_scm_arg 
  228                        | "scheme?" 
                                 function_arglist_closed_optional 
                                 bare_number 
  229                        | "scheme?" function_arglist_optional FRACTION
  230                        | "scheme?" 
                                 function_arglist_closed_optional 
                                 post_event_nofinger 
  231                        | "scheme?" 
                                 function_arglist_closed_optional 
                                 '-' 
                                 NUMBER_IDENTIFIER 
  232                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 SCM_ARG 
  233                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 lyric_element_music 
  234                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 bare_number 
  235                        | function_arglist_common_reparse 
                                 "(reparsed?)" 
                                 symbol_list_arg 

  236 function_arglist_common_reparse: "scheme?" 
                                         function_arglist_optional 
                                         SCM_IDENTIFIER 
  237                                | "scheme?" 
                                         function_arglist_optional 
                                         STRING 
  238                                | "scheme?" 
                                         function_arglist_optional 
                                         full_markup 
  239                                | "scheme?" 
                                         function_arglist_closed_optional 
                                         '-' 
                                         UNSIGNED 
  240                                | "scheme?" 
                                         function_arglist_closed_optional 
                                         '-' 
                                         REAL 

  241 function_arglist_closed: function_arglist_closed_common
  242                        | function_arglist_closed_nonbackup

  243 function_arglist_closed_common: function_arglist_bare
  244                               | "scheme?" 
                                        function_arglist_optional 
                                        embedded_scm_arg_closed 
  245                               | "scheme?" 
                                        function_arglist_closed_optional 
                                        bare_number 
  246                               | "scheme?" 
                                        function_arglist_closed_optional 
                                        '-' 
                                        NUMBER_IDENTIFIER 
  247                               | "scheme?" 
                                        function_arglist_closed_optional 
                                        post_event_nofinger 
  248                               | "scheme?" 
                                        function_arglist_optional 
                                        FRACTION 
  249                               | function_arglist_common_reparse 
                                        "(reparsed?)" 
                                        SCM_ARG 
  250                               | function_arglist_common_reparse 
                                        "(reparsed?)" 
                                        bare_number 
  251                               | function_arglist_common_reparse 
                                        "(reparsed?)" 
                                        symbol_list_arg 

  252 function_arglist_optional: function_arglist_keep
  253                          | function_arglist_backup "(backed-up?)"
  254                          | "optional?" 
                                   "ly:pitch?" 
                                   function_arglist_optional 
  255                          | "optional?" 
                                   "ly:duration?" 
                                   function_arglist_optional 

  256 function_arglist_closed_optional: function_arglist_closed_keep
  257                                 | function_arglist_backup 
                                          "(backed-up?)" 
  258                                 | "optional?" 
                                          "ly:pitch?" 
                                          function_arglist_closed_optional 
  259                                 | "optional?" 
                                          "ly:duration?" 
                                          function_arglist_closed_optional 

  260 embedded_scm_closed: embedded_scm_bare
  261                    | scm_function_call_closed

  262 embedded_scm_arg_closed: embedded_scm_bare_arg
  263                        | scm_function_call_closed
  264                        | closed_music

  265 scm_function_call_closed: SCM_FUNCTION function_arglist_closed

  266 function_arglist_bare: EXPECT_NO_MORE_ARGS
  267                      | "ly:pitch?" 
                               function_arglist_optional 
                               pitch_also_in_chords 
  268                      | "ly:duration?" 
                               function_arglist_closed_optional 
                               duration_length 
  269                      | "optional?" 
                               "ly:pitch?" 
                               function_arglist_skip 
                               "\default" 
  270                      | "optional?" 
                               "ly:duration?" 
                               function_arglist_skip 
                               "\default" 
  271                      | "optional?" 
                               "scheme?" 
                               function_arglist_skip 
                               "\default" 

  272 music_function_call: MUSIC_FUNCTION function_arglist

  273 optional_id: /* empty */
  274            | '=' simple_string

  275 complex_music: music_function_call
  276              | repeated_music
  277              | re_rhythmed_music
  278              | complex_music_prefix music

  279 complex_music_prefix: "\context" 
                              simple_string 
                              optional_id 
                              optional_context_mod 
  280                     | "\new" 
                              simple_string 
                              optional_id 
                              optional_context_mod 

  281 mode_changed_music: mode_changing_head grouped_music_list
  282                   | mode_changing_head_with_context 
                            optional_context_mod 
                            grouped_music_list 

  283 mode_changing_head: "\notemode"
  284                   | "\drummode"
  285                   | "\figuremode"
  286                   | "\chordmode"
  287                   | "\lyricmode"

  288 mode_changing_head_with_context: "\drums"
  289                                | "\figures"
  290                                | "\chords"
  291                                | "\lyrics"

  293 new_lyrics: "\addlyrics"  composite_music

  295 new_lyrics: new_lyrics "\addlyrics" 0 composite_music

  296 re_rhythmed_music: composite_music new_lyrics

  298 re_rhythmed_music: "\lyricsto" simple_string 1 music

  299 context_change: "\change" STRING '=' STRING

  300 property_path: symbol_list_rev
  301              | symbol_list_rev property_path

  302 property_operation: STRING '=' scalar
  303                   | "\unset" simple_string
  304                   | "\override" property_path '=' scalar
  305                   | "\revert" revert_arg

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

  307 revert_arg_backup: revert_arg_part

  308 revert_arg_part: symbol_list_part
  309                | revert_arg_backup 
                         "(backed-up?)" 
                         SCM_ARG 
                         '.' 
                         symbol_list_part 
  310                | revert_arg_backup 
                         "(backed-up?)" 
                         SCM_ARG 
                         symbol_list_part 

  311 context_def_mod: "\consists"
  312                | "\remove"
  313                | "\accepts"
  314                | "\defaultchild"
  315                | "\denies"
  316                | "\alias"
  317                | "\type"
  318                | "\description"
  319                | "\name"

  320 context_mod: property_operation
  321            | context_def_mod STRING
  322            | context_def_mod embedded_scm

  323 grob_prop_spec: symbol_list_rev

  324 grob_prop_path: grob_prop_spec
  325               | grob_prop_spec property_path

  326 context_prop_spec: symbol_list_rev

  327 simple_music_property_def: "\override" grob_prop_path '=' scalar
  328                          | "\revert" simple_revert_context revert_arg
  329                          | "\set" context_prop_spec '=' scalar
  330                          | "\unset" context_prop_spec

  331 simple_revert_context: symbol_list_part

  332 music_property_def: simple_music_property_def

  333 string: STRING
  334       | full_markup
  335       | string '+' string

  336 simple_string: STRING
  337              | embedded_scm_bare

  338 scalar: embedded_scm_arg
  339       | SCM_IDENTIFIER
  340       | bare_number
  341       | FRACTION
  342       | lyric_element

  343 scalar_closed: embedded_scm_arg_closed
  344              | SCM_IDENTIFIER
  345              | bare_number
  346              | FRACTION
  347              | lyric_element

  348 event_chord: simple_element post_events
  349            | simple_chord_elements post_events
  350            | CHORD_REPETITION optional_notemode_duration post_events
  351            | MULTI_MEASURE_REST optional_notemode_duration post_events
  352            | command_element
  353            | note_chord_element

  354 note_chord_element: chord_body optional_notemode_duration post_events

  355 chord_body: "<" chord_body_elements ">"

  356 chord_body_elements: /* empty */
  357                    | chord_body_elements chord_body_element

  358 chord_body_element: pitch 
                            exclamations 
                            questions 
                            octave_check 
                            post_events 
  359                   | DRUM_PITCH post_events
  360                   | music_function_chord_body

  361 music_function_chord_body: music_function_call
  362                          | MUSIC_IDENTIFIER

  363 music_function_call_closed: MUSIC_FUNCTION function_arglist_closed

  364 event_function_event: EVENT_FUNCTION function_arglist_closed

  365 command_element: command_event
  366                | "\["
  367                | "\]"
  368                | "\"
  369                | '|'

  370 command_event: "\~"
  371              | tempo_event

  372 post_events: /* empty */
  373            | post_events post_event

  374 post_event_nofinger: direction_less_event
  375                    | script_dir music_function_call_closed
  376                    | "--"
  377                    | "__"
  378                    | script_dir direction_reqd_event
  379                    | script_dir direction_less_event
  380                    | '^' fingering
  381                    | '_' fingering

  382 post_event: post_event_nofinger
  383           | '-' fingering

  384 string_number_event: E_UNSIGNED

  385 direction_less_char: '['
  386                    | ']'
  387                    | '~'
  388                    | '('
  389                    | ')'
  390                    | "\!"
  391                    | "\("
  392                    | "\)"
  393                    | "\>"
  394                    | "\<"

  395 direction_less_event: direction_less_char
  396                     | string_number_event
  397                     | EVENT_IDENTIFIER
  398                     | tremolo_type
  399                     | event_function_event

  400 direction_reqd_event: gen_text_def
  401                     | script_abbreviation

  402 octave_check: /* empty */
  403             | '=' quotes

  404 quotes: /* empty */
  405       | sub_quotes
  406       | sup_quotes

  407 sup_quotes: '''
  408           | sup_quotes '''

  409 sub_quotes: ','
  410           | sub_quotes ','

  411 steno_pitch: NOTENAME_PITCH quotes

  412 steno_tonic_pitch: TONICNAME_PITCH quotes

  413 pitch: steno_pitch
  414      | PITCH_IDENTIFIER

  415 pitch_also_in_chords: pitch
  416                     | steno_tonic_pitch

  417 gen_text_def: full_markup
  418             | STRING
  419             | embedded_scm_closed

  420 fingering: UNSIGNED

  421 script_abbreviation: '^'
  422                    | '+'
  423                    | '-'
  424                    | '|'
  425                    | ">"
  426                    | '.'
  427                    | '_'

  428 script_dir: '_'
  429           | '^'
  430           | '-'

  431 duration_length: multiplied_duration

  432 maybe_notemode_duration: /* empty */
  433                        | multiplied_duration

  434 optional_notemode_duration: maybe_notemode_duration

  435 steno_duration: UNSIGNED dots
  436               | DURATION_IDENTIFIER dots

  437 multiplied_duration: steno_duration
  438                    | multiplied_duration '*' UNSIGNED
  439                    | multiplied_duration '*' FRACTION

  440 dots: /* empty */
  441     | dots '.'

  442 tremolo_type: ':'
  443             | ':' UNSIGNED

  444 bass_number: UNSIGNED
  445            | STRING
  446            | full_markup
  447            | embedded_scm_bare

  448 figured_bass_alteration: '-'
  449                        | '+'
  450                        | '!'

  451 bass_figure: "_"
  452            | bass_number
  453            | bass_figure ']'
  454            | bass_figure figured_bass_alteration
  455            | bass_figure figured_bass_modification

  456 figured_bass_modification: "\+"
  457                          | "\!"
  458                          | '/'
  459                          | "\"

  460 br_bass_figure: bass_figure
  461               | '[' bass_figure

  462 figure_list: /* empty */
  463            | figure_list br_bass_figure

  464 figure_spec: FIGURE_OPEN figure_list FIGURE_CLOSE

  465 optional_rest: /* empty */
  466              | "\rest"

  467 simple_element: pitch 
                        exclamations 
                        questions 
                        octave_check 
                        maybe_notemode_duration 
                        optional_rest 
  468               | DRUM_PITCH optional_notemode_duration
  469               | RESTNAME optional_notemode_duration

  470 simple_chord_elements: new_chord
  471                      | figure_spec optional_notemode_duration

  472 lyric_element: full_markup
  473              | STRING
  474              | LYRIC_ELEMENT

  475 lyric_element_music: lyric_element 
                             optional_notemode_duration 
                             post_events 

  476 new_chord: steno_tonic_pitch optional_notemode_duration
  477          | steno_tonic_pitch 
                   optional_notemode_duration 
                   chord_separator 
                   chord_items 

  478 chord_items: /* empty */
  479            | chord_items chord_item

  480 chord_separator: ":"
  481                | "^"
  482                | "/" steno_tonic_pitch
  483                | "/+" steno_tonic_pitch

  484 chord_item: chord_separator
  485           | step_numbers
  486           | CHORD_MODIFIER

  487 step_numbers: step_number
  488             | step_numbers '.' step_number

  489 step_number: UNSIGNED
  490            | UNSIGNED '+'
  491            | UNSIGNED "-"

  492 tempo_range: UNSIGNED
  493            | UNSIGNED '~' UNSIGNED

  494 number_expression: number_expression '+' number_term
  495                  | number_expression '-' number_term
  496                  | number_term

  497 number_term: number_factor
  498            | number_factor '*' number_factor
  499            | number_factor '/' number_factor

  500 number_factor: '-' number_factor
  501              | bare_number

  502 bare_number: bare_number_closed
  503            | UNSIGNED NUMBER_IDENTIFIER
  504            | REAL NUMBER_IDENTIFIER

  505 bare_number_closed: UNSIGNED
  506                   | REAL
  507                   | NUMBER_IDENTIFIER

  508 unsigned_number: UNSIGNED
  509                | NUMBER_IDENTIFIER

  510 exclamations: /* empty */
  511             | exclamations '!'

  512 questions: /* empty */
  513          | questions '?'

  515 full_markup_list: "\markuplist" 2 markup_list

  517 full_markup: "\markup" 3 markup_top

  518 markup_top: simple_markup_list
  519           | markup_head_1_list simple_markup
  520           | simple_markup

  522 markup_scm: embedded_scm_bare 4 "(backed-up?)"

  523 simple_markup_list: markup_composed_list
  524                   | markup_uncomposed_list

  525 markup_uncomposed_list: markup_braced_list
  526                       | markup_command_list
  527                       | markup_scm MARKUPLIST_IDENTIFIER

  528 markup_list: simple_markup_list
  529            | markup_score

  531 markup_score: "\score" 5 '{' score_body '}'

  532 markup_composed_list: markup_head_1_list markup_uncomposed_list

  533 markup_braced_list: '{' markup_braced_list_body '}'

  534 markup_braced_list_body: /* empty */
  535                        | markup_braced_list_body markup
  536                        | markup_braced_list_body simple_markup_list

  537 markup_command_list: MARKUP_LIST_FUNCTION markup_command_list_arguments

  538 markup_command_basic_arguments: "markup-list?" 
                                        markup_command_list_arguments 
                                        markup_list 
  539                               | "scheme?" 
                                        markup_command_list_arguments 
                                        embedded_scm_closed 
  540                               | EXPECT_NO_MORE_ARGS

  541 markup_command_list_arguments: markup_command_basic_arguments
  542                              | "markup?" 
                                       markup_command_list_arguments 
                                       markup 

  543 markup_head_1_item: MARKUP_FUNCTION 
                            "markup?" 
                            markup_command_list_arguments 

  544 markup_head_1_list: markup_head_1_item
  545                   | markup_head_1_list markup_head_1_item

  546 simple_markup: STRING
  547              | MARKUP_FUNCTION markup_command_basic_arguments
  548              | markup_scm MARKUP_IDENTIFIER
  549              | markup_score

  550 markup: markup_head_1_list simple_markup
  551       | simple_markup


Terminals, with rules where they appear



    185 186 195 196 200 201 202 207 208 209 210 211 212 213 214 215
    200 201 202 207 208 209 210 211 212 213 214 215 216 219 220 221
    216 217 218 219 220 221 254 255 258 259 269 270 271
    227 228 229 230 231 236 237 238 239 240 244 245 246 247 248 271
    493 503 505 508
    500
    539
    546
"#{" (351) 3
"(backed-up?)" (346) 133 134 221 253 257 306 309 310 522
"(reparsed?)" (347) 197 198 199 222 223 232 233 234 235 249 250 251
"-" (317) 491
"--" (338) 376
"/" (318) 482
"/+" (314) 483
":" (316) 480
"<" (319) 355
"<<" (321) 145
">" (320) 355 425
">>" (322) 145
"\!" (327) 390 457
"\" (323) 368 459
"\(" (329) 391
"\)" (326) 392
"\+" (332) 456
"\<" (331) 394
"\>" (324) 393
"\[" (328) 366
"\]" (330) 367
"\accepts" (273) 313
"\addlyrics" (262) 293 295
"\alias" (274) 316
"\alternative" (260) 141
"\book" (275) 73
"\bookpart" (276) 87
"\C[haracter]" (325)
"\change" (277) 299
"\chordmode" (278) 286
"\chords" (279) 290
"\consists" (280) 311
"\context" (281) 64 115 279
"\default" (263) 269 270 271
"\defaultchild" (282) 314
"\denies" (283) 315
"\description" (284) 318
"\drummode" (285) 284
"\drums" (286) 288
"\figuremode" (287) 285
"\figures" (288) 289
"\header" (289) 47
"\layout" (291) 111
"\lyricmode" (292) 287
"\lyrics" (293) 291
"\lyricsto" (294) 298
"\markup" (295) 517
"\markuplist" (296) 515
"\midi" (297) 110
"\name" (298) 319
"\new" (313) 280
"\notemode" (299) 283
"\override" (300) 304 327
"\paper" (301) 109
"\remove" (302) 312
"\repeat" (259) 140 141
"\rest" (303) 466
"\revert" (304) 305 328
"\score" (305) 100 531
"\sequential" (306) 142
"\set" (307) 329
"\simultaneous" (308) 144
"\tempo" (309) 123 124 125
"\type" (310) 317
"\unset" (311) 303 330
"\version-error" (290) 8 43
"\with" (312) 150 151 153
"\~" (333) 370
"^" (315) 481
"_" (337) 451
"__" (334) 377
"end of input" (0) 0
"ly:duration?" (344) 172 175 218 255 259 268 270
"ly:pitch?" (343) 171 174 217 254 258 267 269
"markup-list?" (348) 538
"markup?" (342) 542 543
"optional?" (349) 171 172 173 174 175 176 177 178 179 180 182 183 184
"scheme?" (345) 173 176 177 178 179 180 182 183 184 185 186 195 196
'!' (33) 450 511
''' (39) 407 408
'(' (40) 388
')' (41) 389
'*' (42) 438 439 498
'+' (43) 335 422 449 490 494
',' (44) 409 410
'-' (45) 178 179 180 214 215 216 231 239 240 246 383 423 430 448 495
'.' (46) 188 190 309 426 441 488
'/' (47) 458 499
':' (58) 442 443
'=' (61) 49 50 123 124 274 299 302 304 327 329 403
'?' (63) 513
'[' (91) 385 461
']' (93) 386 453
'^' (94) 380 421 429
'_' (95) 381 427 428
'{' (123) 47 64 73 87 100 115 116 117 129 150 531 533
'|' (124) 369 424
'}' (125) 47 64 73 87 100 108 115 129 150 531 533
'~' (126) 387 493
BOOK_IDENTIFIER (352) 75 89
CHORD_MODIFIER (354) 486
CHORD_REPETITION (355) 350
CHORDMODIFIER_PITCH (353)
CHORDMODIFIERS (339)
COMPOSITE (261)
CONTEXT_DEF_IDENTIFIER (356) 69
CONTEXT_MOD_IDENTIFIER (357) 151 152 158
DRUM_PITCH (358) 359 468
DURATION_IDENTIFIER (265) 436
E_UNSIGNED (341) 384
error (256) 7 42 86 99 106 122 128
EVENT_FUNCTION (360) 364
EVENT_IDENTIFIER (359) 397
EXPECT_NO_MORE_ARGS (350) 266 540
FIGURE_CLOSE (335) 464
FIGURE_OPEN (336) 464
FRACTION (361) 59 176 213 229 248 341 346 439
FUNCTION_ARGLIST (264)
LYRIC_ELEMENT (362) 474
MARKUP_FUNCTION (363) 543 547
MARKUP_IDENTIFIER (365) 548
MARKUP_LIST_FUNCTION (364) 537
MARKUPLIST_IDENTIFIER (366) 527
MULTI_MEASURE_REST (340) 351
MUSIC_FUNCTION (367) 272 363
MUSIC_IDENTIFIER (368) 166 362
NOTENAME_PITCH (269) 411
NUMBER_IDENTIFIER (271) 180 212 216 231 246 503 504 507 509
OUTPUT_DEF_IDENTIFIER (369) 117
PITCH_IDENTIFIER (270) 414
PREC_BOT (258)
PREC_TOP (272)
REAL (266) 179 211 215 240 504 506
RESTNAME (370) 469
SCM_ARG (371) 24 133 197 232 249 309 310
SCM_FUNCTION (372) 38 265
SCM_IDENTIFIER (373) 21 22 184 200 219 236 339 344
SCM_TOKEN (374) 17 20 25 82 95
STRING (375) 48 185 192 201 220 237 299 302 321 333 336 418 445 473
SYMBOL_LIST (376) 187 188
TONICNAME_PITCH (268) 412
UNARY_MINUS (377)
UNSIGNED (267) 178 210 214 239 420 435 438 443 444 489 490 491 492

Nonterminals, with rules where they appear


assignment (160)
    on left: 49 50, on right: 6 45 118
assignment_id (159)
    on left: 48, on right: 49 50
bare_number_closed (315)
    on left: 505 506 507, on right: 183 502
bass_number (292)
    on left: 444 445 446 447, on right: 452
book_block (166)
    on left: 73, on right: 11 30 52
bookpart_block (169)
    on left: 87, on right: 12 31 53 77
br_bass_figure (296)
    on left: 460 461, on right: 463
braced_music_list (185)
    on left: 129, on right: 141 142 143 144
chord_body (258)
    on left: 355, on right: 354
chord_body_element (260)
    on left: 358 359 360, on right: 357
chord_body_elements (259)
    on left: 356 357, on right: 355 357
chord_item (307)
    on left: 484 485 486, on right: 479
chord_items (305)
    on left: 478 479, on right: 477 479
chord_separator (306)
    on left: 480 481 482 483, on right: 477 484
closed_music (200)
    on left: 162 163 164, on right: 163 264
command_element (264)
    on left: 365 366 367 368 369, on right: 352
command_event (265)
    on left: 370 371, on right: 365
complex_music (228)
    on left: 275 276 277 278, on right: 160
complex_music_prefix (229)
    on left: 279 280, on right: 163 278
context_change (238)
    on left: 299, on right: 148
context_def_spec_block (162)
    on left: 64, on right: 29 55
context_mod (245)
    on left: 320 321 322, on right: 70 157
context_mod_arg (163)
    on left: 65 66, on right: 67
context_mod_embedded (164)
    on left: 67, on right: 72 159
context_prop_spec (248)
    on left: 326, on right: 329 330
direction_reqd_event (272)
    on left: 400 401, on right: 378
dots (290)
    on left: 440 441, on right: 435 436 441
duration_length (285)
    on left: 431, on right: 175 218 268
embedded_lilypond (156)
    on left: 39 40 41 42 43, on right: 3 43
embedded_scm (153)
    on left: 33 34, on right: 46 61 65 119 322
embedded_scm_active (151)
    on left: 22 23, on right: 18 83 96 102
embedded_scm_arg (154)
    on left: 35 36 37, on right: 195 227 338
embedded_scm_bare (150)
    on left: 20 21, on right: 33 193 260 337 447 522
embedded_scm_closed (222)
    on left: 260 261, on right: 135 153 419 539
event_chord (256)
    on left: 348 349 350 351 352 353, on right: 146
event_function_event (263)
    on left: 364, on right: 399
exclamations (317)
    on left: 510 511, on right: 358 467 511
figure_list (297)
    on left: 462 463, on right: 463 464
figure_spec (298)
    on left: 464, on right: 471
figured_bass_alteration (293)
    on left: 448 449 450, on right: 454
figured_bass_modification (295)
    on left: 456 457 458 459, on right: 455
fingering (282)
    on left: 420, on right: 380 381 383
full_markup_list (319)
    on left: 515, on right: 16 26 62 81 94
gen_text_def (281)
    on left: 417 418 419, on right: 400
grob_prop_path (247)
    on left: 324 325, on right: 327
grob_prop_spec (246)
    on left: 323, on right: 324 325
grouped_music_list (202)
    on left: 168 169, on right: 167 281 282
lilypond (147)
    on left: 4 5 6 7 8, on right: 1 5 6 7 8
lilypond_header (158)
    on left: 47, on right: 10 85 98 104
lilypond_header_body (157)
    on left: 44 45 46, on right: 45 46 47
lyric_element (302)
    on left: 472 473 474, on right: 342 347 475
lyric_element_music (303)
    on left: 475, on right: 131 134 198 233
markup (340)
    on left: 550 551, on right: 535 542
markup_braced_list (332)
    on left: 533, on right: 525
markup_braced_list_body (333)
    on left: 534 535 536, on right: 533 535 536
markup_command_list (334)
    on left: 537, on right: 526
markup_composed_list (331)
    on left: 532, on right: 523
markup_head_1_item (337)
    on left: 543, on right: 544 545
markup_head_1_list (338)
    on left: 544 545, on right: 519 532 545 550
markup_list (328)
    on left: 528 529, on right: 515 538
markup_scm (324)
    on left: 522, on right: 527 548
markup_score (329)
    on left: 531, on right: 529 549
markup_top (323)
    on left: 518 519 520, on right: 517
markup_uncomposed_list (327)
    on left: 525 526 527, on right: 524 532
maybe_notemode_duration (286)
    on left: 432 433, on right: 434 467
mode_changed_music (230)
    on left: 281 282, on right: 165
mode_changing_head (231)
    on left: 283 284 285 286 287, on right: 281
multiplied_duration (289)
    on left: 437 438 439, on right: 431 433 438 439
music (186)
    on left: 130 131, on right: 101 132 140 141 278 298
music_arg (189)
    on left: 136 137, on right: 37 113 130
music_assign (190)
    on left: 138 139, on right: 56
music_bare (201)
    on left: 165 166 167, on right: 161 162
music_embedded (187)
    on left: 132 133 134, on right: 41 127
music_embedded_backup (188)
    on left: 135, on right: 133 134
music_function_call (226)
    on left: 272, on right: 275 361
music_function_call_closed (262)
    on left: 363, on right: 164 375
music_function_chord_body (261)
    on left: 361 362, on right: 360
music_list (184)
    on left: 126 127 128, on right: 41 127 128 129 145
music_or_context_def (179)
    on left: 113 115, on right: 121
music_property_def (251)
    on left: 332, on right: 147
new_chord (304)
    on left: 476 477, on right: 470
new_lyrics (233)
    on left: 293 295, on right: 295 296
note_chord_element (257)
    on left: 354, on right: 353
number_expression (311)
    on left: 494 495 496, on right: 58 494 495
number_factor (313)
    on left: 500 501, on right: 497 498 499 500
number_term (312)
    on left: 497 498 499, on right: 494 495 496
octave_check (273)
    on left: 402 403, on right: 358 467
optional_context_mod (197)
    on left: 154 155, on right: 279 280 282
optional_id (227)
    on left: 273 274, on right: 279 280
optional_rest (299)
    on left: 465 466, on right: 467
output_def (176)
    on left: 108, on right: 19 32 54 105 107
output_def_head (177)
    on left: 109 110 111, on right: 112
output_def_head_with_mode_switch (178)
    on left: 112, on right: 116 117
paper_block (175)
    on left: 107, on right: 76 90
pitch (279)
    on left: 413 414, on right: 358 415 467
pitch_also_in_chords (280)
    on left: 415 416, on right: 174 217 267
post_event (268)
    on left: 382 383, on right: 373
property_operation (240)
    on left: 302 303 304 305, on right: 320
property_path (239)
    on left: 300 301, on right: 50 301 304 325
questions (318)
    on left: 512 513, on right: 358 467 513
quotes (274)
    on left: 404 405 406, on right: 403 411 412
re_rhythmed_music (236)
    on left: 296 298, on right: 277
repeated_music (191)
    on left: 140 141, on right: 276
revert_arg (241)
    on left: 306, on right: 305 328
revert_arg_backup (242)
    on left: 307, on right: 306 309 310
revert_arg_part (243)
    on left: 308 309 310, on right: 307
scalar (254)
    on left: 338 339 340 341 342, on right: 125 302 304 327 329
scalar_closed (255)
    on left: 343 344 345 346 347, on right: 124
scm_function_call (155)
    on left: 38, on right: 23 34 36
scm_function_call_closed (224)
    on left: 265, on right: 261 263
score_block (172)
    on left: 100, on right: 13 28 51 78 91
script_dir (284)
    on left: 428 429 430, on right: 375 378 379
sequential_music (192)
    on left: 142 143, on right: 169
simple_chord_elements (301)
    on left: 470 471, on right: 349
simple_element (300)
    on left: 467 468 469, on right: 348
simple_markup (339)
    on left: 546 547 548 549, on right: 519 520 550 551
simple_markup_list (326)
    on left: 523 524, on right: 518 528 536
simple_music (194)
    on left: 146 147 148, on right: 136 138
simple_music_property_def (249)
    on left: 327 328 329 330, on right: 332
simple_revert_context (250)
    on left: 331, on right: 328
simultaneous_music (193)
    on left: 144 145, on right: 168
start_symbol (145)
    on left: 1 3, on right: 0
steno_duration (288)
    on left: 435 436, on right: 123 124 437
steno_pitch (277)
    on left: 411, on right: 413
steno_tonic_pitch (278)
    on left: 412, on right: 416 476 477 482 483
step_number (309)
    on left: 489 490 491, on right: 487 488
step_numbers (308)
    on left: 487 488, on right: 485 488
string (252)
    on left: 333 334 335, on right: 60 335
string_number_event (269)
    on left: 384, on right: 396
sub_quotes (276)
    on left: 409 410, on right: 405 410
sup_quotes (275)
    on left: 407 408, on right: 406 408
symbol_list_arg (206)
    on left: 187 188, on right: 199 223 235 251 306
symbol_list_element (209)
    on left: 192 193, on right: 191
symbol_list_part (208)
    on left: 191, on right: 189 190 308 309 310 331
symbol_list_rev (207)
    on left: 189 190, on right: 188 190 300 301 323 326
tempo_event (183)
    on left: 123 124 125, on right: 371
tempo_range (310)
    on left: 492 493, on right: 123 124
tremolo_type (291)
    on left: 442 443, on right: 398
unsigned_number (316)
    on left: 508 509, on right: 140 141

LilyPond — Contributor’s Guide