parser question

Micah Elliott mde at micah.elliott.name
Wed Oct 19 11:47:07 EDT 2005


On Oct 19, Daniel Sch�le wrote:
> I have one format with this structure
> 
> A {
>         x=1
>         y=3
>         B {
>             z  = "something here"
>         }
>     }
> 
> C {
>     }
> 
> A {
>         x=0
>         y=0
>         B {
>             z  = "other"
>         }
>     }
> 
> are there parsers for this kind of structure?
> specially I am interested in all A blocks
> 
> just now, I am trying to solve it with re,

You might be able to tackle this easily enough with REs if your
structures don't nest arbitrarily.  It's hard to tell if this deserves
a formal grammar based on the example.  If it does, you could try PLY
<http://www.dabeaz.com/ply/> (which I've had a pleasant experience
with in the past) or any of the other parsers listed on the PLY site's
"Other Python Parsing Tools".

-- 
_  _     ___
|\/|icah |- lliott  http://micah.elliott.name  mde at micah.elliott.name
"  "     """



More information about the Python-list mailing list