Richard Robinson writes: | I was thinking about this over the weekend ... Always a mistake. ;-)
| I needes an abc parser last autumn, for my tunes-comparison project, | and really didn't want to write my own. So I used James Allwright's - | he uses it with different backends, to generate ps, midi & abc, so it's | already separated out as necessary, all you need to do is supply the | event-handlers. But this created problems, since one of the bodies of music | I was most interested in looking at was the VMP, which mostly uses abc2win, | and it doesn't handle the "!" linebreaks ... | | In short, I agree. A "community parser" would be a good and useful | thing. I was away for the weekend and am still catching up (you busy | people !) so I haven't got round to looking at John's code, to have any | idea how hard it would be to carve it out of the surrounding code, or | what sort sort of interface it would need, but I get the impression it | could be a good starting point. The liberal approach (handle what's "out there") | would make it the most useful, plus that John's involved here. | | I'd be prepared to try & help with such a project. What do you think, | John, would you support this ? Well, I'm not sure what "support" is needed. At first, it was easy to handle abc2win's use of !, since you could just treat it as a space. Then people came out with the !...! idea, and of course you'd want to handle those. So now you need a way of distinguishing the two meanings. I'm pretty sure that you won't find a good solution; the best is probably the kludge (i.e., heuristic) that I mentioned earlier. The abc2win ! could probably be included in a BNF syntax, but the result has a rather nasty ambiguity. So no matter what you do, you're facing either editing every abc2win file by hand, or writing a big of kludgery to distinguish the two uses. Actually, I do think this is a bit overblown. The "kludge" approach is a fairly small chunk of code, and seems to work pretty well. We can probably construct some pathological cases (like !fff!fff!), but they will be so rare in practice that we can just shrug and look the other way. I think the line-wrap problem is actually a bigger mess, since it produces illegal abc. One suggestion for a parser might be to bury this problem inside the input routine. It can easily implement the kludgery to detect the abc2win ! and replace it with a space. The resulting abc should be amenable to systematic parsing. I do wish that abc2win would itentify itself early in the headers. How pathological this can be was indicated in the recent example that contained a :|!: between two phrases. That's just pure perversity. I hope it was a bug, but I wouldn't put money on that. To subscribe/unsubscribe, point your browser to: http://www.tullochgorm.com/lists.html