Parsing library for Python?

Paul McGuire ptmcg at users.sourceforge.net
Tue Feb 24 13:55:08 EST 2004


"Edward C. Jones" <edcjones at erols.com> wrote in message
news:403b7517$0$3068$61fed72c at news.rcn.com...
> Tim Roberts wrote:
> > "Edward C. Jones" <edcjones at erols.com> wrote:
> >
> >>When looking for a parser generator, I think it is important that full
> >>grammars be provided for at least C and Python and preferably for C++,
> >>Java, and FORTRAN.
> >
> >
> > Are you kidding with this?  I can't tell.
> >
> > C, C++, and Fortran are parsing nightmares, where end-of-line and
spacing
> > are important sometimes and ignored at other times, and so on.
> >
> > I expect to find the canonical desk calculator example, and perhaps a
> > Pascal-based language, but any more than that is asking a bit much from
all
> > but the most mature parser generators.
>
> Not kidding. Nothing can be parsed without a grammar. I think parsing
> the standard computer languages is a common need. I am sporatically
> developing software to automatically generate Pyrex code for wrapping C
> libraries in Python. I use ANTLR because it comes with a good C grammar.
>
> And then there is HTML. I wonder how Mozilla parses all the ill-formed
> html that is on the web.

I'm looking for the C grammar in ANTLR.  Do you mean the tinyC example?
That leaves out a *lot*.  (There are grammars for Java and Pascal included,
and they look pretty complete.)

-- Paul





More information about the Python-list mailing list