Remo, I'd love to share ideas back and forth. I have looked at your parser (we started work on our parsers at almost the same time). However, I needed to be able to write out MIDI files that correctly supported voice overlays quickly so I wrote the code this way and then sat on it for many months and now have finally gotten back to working on it again. My goal is to have a python parser that will read an ABC file and completely populate a set of python data structures with the data from the file -- to the point where you should be able to write a functionally equivalent, and almost verbatim, ABC output file from the structures.
I just changed all of the code over to not pre-process ABC files. I used to pre-process them to remove comments and join lines with line continuations and to convert 1.6 ABC constructs to 2.0. Then I decided that having comments and line continuations in the BNF made it harder to implement but made it better at reporting errors (I don't have to keep a table of original line numbers to new line numbers any more) and at keeping comments and line continuations as part of my overall data structures. So, I moved the pre-process function into a separate script - abc16to20.py that I use to convert old files before I test them. After all of this changing, my gold standard - dyna.abc no longer parses all the way through (I run it through the converter script then take that output and use it as input to dumpabc.py). I am working on that right now. The code is currently still very much in the middle of being worked on, but I have attached a tar file that has the current state. I have seen the proposals on the list for semi-tones and for drum notations and plan to add those to the BNF but have not gotten that far yet... Also, I need to write and update most of the documentation before I post it to sourceforge. The code is licensed under GPL. It uses the python simpleparse library, which requires the python mxtexttools library. I am using SimpleParse-2.0.1a3 and know that one of the earlier versions had a bug that caused it to not work correctly with this code. Very rough structure goes like this: abcpy.py - the python data structures that hold the parsed data abc.def - the simpleparse EBNF file abcparser.py - reads the ABC file and populates the abcpy.py data structures abc16to20.py - my preprocessor broken out to a separate exec - very rough abc2midi.py - my abc2midi converter - still very basic midipy.py - a midi library that I got from Will Ware and have been updating dumpabc.py - my test dumper - takes an ABC file and parses it and dumps it dyna.abc - the dyna.abc file - in 1.6 format scale.abc - a small test file that I use as I am testing new constructs If you have any questions or suggestions I'd love to hear them... I'll send the attachment to you alone so that I don't clog up the list. If anyone else wants it just drop me an e-mail. tom On Wed, Nov 23, 3:17 pm, Remo D. wrote: > Subject: Re: [abcusers] Re: An optional pitch syntax? > To: abcusers@yahoogroups.com > > Tom Satter wrote: > > I have the python parser to the point where it can syntactically read > > almost all 2.0 ABC and I have a pre-processor that will convert 1.6 ABC to > > 2.0 format so I can read that also. I have semantically covered about 60% > > of the ABC 2.0 constructs so far and used them to populate a number of > > Python data structures. I have written a midi out program that can play > > all 2.0 constructs with the exception of tuples (I just have not finished > > coding them yet, there is nothing especially hard about them). > > Tom, as you may (or may not) know, I'm writing a generic parser in C to > be embedded in other applications (http://abcp.sourceforge.net). To test > it I created a binding for Lua and I was exactly creating the Lua > structure to be populated > > I would be very interested to have a look at your work (if the source > is available) and share ideas around this topic. Let me know if you're > interested as well. > > Regards, > Remo -- tom - just plain old tom --- [EMAIL PROTECTED] (303) 499-4100 (work) (303) 543-7623 (home) ------------------------ Yahoo! Groups Sponsor --------------------~--> Get fast access to your favorite Yahoo! Groups. Make Yahoo! your home page http://us.click.yahoo.com/dpRU5A/wUILAA/yQLSAA/mjFolB/TM --------------------------------------------------------------------~-> Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/abcusers/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/