Parsing, oh my…
Recently I have been thinking about parsing. There are two areas of Spineless (yes, I'm continuing to develop the engine, but only for my game project, not for the public for now) that need some kind of parsing to implement cleanly: C library support and COLLADA loading.
To use C libraries from Python, I'm going to parse their headers to generate a ctypes interface which can then be used from Python without any compiling required. There are existing solutions, such as the ctypes code generator, but nothing that could be called a released product. So I'm going to see how difficult it would be to do myself. Parsing is a huge topic however, as demonstarted, for example, by this old newsgroup topic: http://www.thescripts.com/forum/thread41389.html. The two tools I'm initially considering are Pyparsing, which might be too simple (ie. tedious to do complex stuff with) for my purposes, and PLY, which might be far too complex (ie. hard to learn) for this relatively simple task. Experience on either of the tools or other suggestions are really welcome, I'll be sure to post mine when I have learned more!
COLLADA, as you may know, is an XML-based 3D asset file format. Unfortunately the official API, COLLADA DOM, is a C++ library, and using C++ libraries from Python is a can of worms I'm not willing to open if I can avoid it. Until now, I have been writing code to read COLLADA files by hand, but it's really quickly getting really messy. Instead I'm going to generate a Python interface / COLLADA parser based on the XML Schema describing the file format. There's an excellent-looking tool for it too, called generateDS, but unfortunately it fails when trying to read the COLLADA XML Schema, hanging forever. I sent an e-mail to the author, and I hope he can fix the problem. Failing that, it seems I'm on my own, as there don't seem to be any Python libraries to help with parsing XML Schema. All I can find are tools for validating documents based on a schema, but that's not what I'm trying to do... Again, suggestions are welcome!
