photo
Jordan Sissel
geek

Tue, 18 Jul 2006

Python's seeming lack of good parser

I've been searching for a decent recursive descent parser for Python. Too bad I haven't found one :(

None are truely standalone, though many claim to be generators. Either generate code or give me a nice parser library, not half-assedly in the middle! Urgh!

ANTLR depends on import antlr and Java. PLY does similar. Others simply suck. Who wants to lug around piles of libraries and modules? I don't. PLY may be an option, but it may be some time before I can make a decent grammar with it. Perhaps in a day or two when I have more time.

Granted, I'm probably just frustrated from many hours of trying parsers without success. It's not that there aren't any parsers that don't work. It's that there aren't any parsers that are as easy to use as perl's Parse::RecDescent.

All I want is to parse an extremely simple config file of my own design. I may not even need recursive descent, seeing as how I only go 1 level deep. Though, I would prefer a token parser that suited my needs (cfgparser is too limited, shlex is broken), I haven't been able to find one.

I was able to get a config file parser with older grok using Parse::RecDescent in only a few hours, and even after 10 minutes I was using it successfully. Have parsers fallen to the way-side with the advent of XML as a cure-all?

This pisses me off. I should be able to say, "here's the grammar for my data" and be happy. I really wanted to get the config parser done in py grok tonight. I'm giving serious consideration to adding multiline and statefulness support to grok, just so I can parse a damned config file. That is, use grok to read it's own config file so that we can grok whatever data the config file says.

If you're reading, and you have suggestions for python text parsing modules that do not suck, please let me know.

Comments: 1 (view comments)
Tags:
Permalink: /rants/python-parser-modules
posted at: 02:32


1 responses to 'Python's seeming lack of good parser'

Tiago Bastos posted at Thu Jan 25 09:36:35 2007...
Shlex broken? I wanna suggestions too...


Leave a reply

You need javascript enabled to use this form. Anti-spam efforts ongoing. Also, if the comment doesn't show up, it's because the form expired. Go back and copy your comment, reload the form, and resubmit. Apologies if this is a hassle, I'm just playing with antispam methods right now. If this insists on not working, please email me about it.

Name (required)
E-mail (optional, if you want me to be able to email you back)
URL (also optional)
Comment:


Search this site

Navigation

Metadata

Home About Resume My Code (SVN)

Articles

ARP Security Dynamic DNS with DHCP OpenLDAP+Kerberos+SASL PPP over SSH SSH Security: /bin/false Week of Unix Tools Work Efficiency

Projects

fex firefox tabsearch firefox urledit grok keynav liboverride newpsm (FreeBSD) nis2ldap pam_captcha poor man's backup Solaris audio utility xboxproxy xdotool xmlpresenter xpathtool misc scripts

Presentations

Yahoo! Hack Day '08 Yahoo! Hack Day '06 Unix Essentials Vi/Vim Essentials SSH Tunneling (Video)

Tag Cloud

Calendar

< July 2006 >
SuMoTuWeThFrSa
       1
2 3 4 5 6 7 8
9101112131415
16171819202122
23242526272829
3031     

Friends

BarCamp Kent Brewster Tantek Çelik John Resig Wesley Shields Tyler Shields

Technorati