| Did you know ... | Search Documentation: |
| Pack plumdrum -- prolog/humdrum/humutils.pl |
This module provides some utility predicates for parsing. They all operate as part of a DCG where the threaded state is a list of character codes.
Parsers in this module use the following data types:
recip ---> X:natural % duration is 1/X except for X=0, then duration=2
; dots(X:natural,N:natural) % add N dots, means (1/X)*(3/2)^N
pitch_class ---> a ; b ; c ; d ; e ; f ; g
; sharp(pitch_class)
; flat(pitch_class).
barline_attribute ---> double
; ortho(list(barline_ortho))
; number(natural)
; number(natural,natural)
; pause.
barline_ortho ---> normal ; heavy ; partial1 ; partial2 ; invisible ; repeat.
list(A) DCG and unifies X with the first one or two
elements of the list being parsed. Can be used in a DCG to peek
the first one or two elements of the unparsed % list without
removing them.
pitch --> pitch_octave, modifiers.
pitch_octave --> {member(N,"abcdefg")}, +[N] % each extra N goes up 1 octave
; {member(N,"ABCDEFG")}, +[N]. % each extra N goes down 1 octave
modifiers --> +"#" % one or more sharps
; +"-" % one or more flats
; "n" % explicity natural
; "". % implicit natural
+X --> X ; X, +X. % one or more copies of X.
The following predicates are exported, but not or incorrectly documented.