This is a slightly-edited excerpt from the abcsound.py documentation, which I thought might be of general interest:
An interesting fact about musical notation as a language (and a fairly obvious one, after thinking about it a bit) is that music does not have a recursive structure, as do the vast majority of other things that we think of as "languages". In English and other human languages, for example, a sentence consists of phrases which consist of words, you can identify the boundaries of those things, and they nest inside one another like matryushka dolls. You will never find a single word that sits half in one phrase and half in another, or a phrase that is split across multiple sentences. (In theory, anyway -- real language use is pretty messy.)
Musical notation, however, does not have that kind of structure, even in theory. A musical score consists of sections which consist of measures, but musical phrases, and even single notes, can span those boundaries more-or-less at will. The structure of repeats, too, is non-recursive -- a single "prefix" (repeated section) can notationally be paired with multiple suffix sections, which is sort of like having a single phrase that takes part in multiple sentences.
This means that the usual formal approaches to language parsing applied in computer science do not work very well for musical notation (including abc). Rather than trying to parse a score into smaller components -- sections or measures -- and then identify the sub-components of those, we must simply treat a score as a linear list of "events" (or "elements" as I call them in abcsound), and then compute the relations between those events. Applying this approach to abc makes me wonder if a similar one might be usefully applied to human language -- even though human languages seem to be recursively structured, it's not so obvious that humans actually process language in a recursive way. (A canonical example of a sentence that is perfectly grammatical, recursively-structured English, but which most humans have to look at a few times in order to parse, is: "The girl the boy the dog bit hit cried.")


