Want to play with or learn a parser system including a grammar for Python? See spark_parser on pypy

rocky rocky at gnu.org
Fri Jun 10 20:56:12 EDT 2016


On Friday, June 10, 2016 at 4:33:28 AM UTC-4, Robin Becker wrote:
> On 08/06/2016 19:32, rocky wrote:
> ..........
> >
> > Sorry that should have been 1998 which would make more sense for the 7th  conference if the 1st one was around 2001. I've corrected the date in [1] https://pypi.python.org/pypi/spark_parser/1.3.0
> >
> > The automated tests in the package just don't  catch stuff like this. But I'm sure there are also other mistakes as well in there so feel free to let me know.
> >
> not a big deal; I like the spark parser :)
> -- 
> Robin Becker

It is cool for how small in code size, how general, (more general than LL or LR), and how fast it works for well-crafted grammars. Surprisingly little was needed to make it work on Python 3 (as well as addition on Python 2).

It has however long been neglected. John stopped working on it around 2002 or so without having put it on Pypy. Since it wasn't it's own package, so you had to find some other project (with possibly varying versions of the program) and copy the spark.py file from that or download the "0.7 pre-alpha" version of 2002 from John's website and possibly modify it if you have Python 3. 

Ok. So I've got that addressed by putting it in pypy. 

But the other basic area of neglect as documentation. John's paper I find woefully inadequate. Most of the projects on John's site that say they use SPARK are now dead links. And using the various uncompyle/decompyle programs as a tutorial for the parser is a bit whacky too as these are very complicated, and not intended as a tutorial.

I've only started to address this by putting together some simple examples. And on http://github.com/rocky/python-spark there is now a wiki to try to address some of this as well. In the wiki for http://github.com/rocky/python-uncompyle6 I've extracted the documentation for the table-driven formatting, but more is needed here as well.

So if you or other like this and know to to use it, please consider beefing up the wiki. Thanks.



More information about the Python-list mailing list