Parsers with Python

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Daniel Carrera

    Parsers with Python

    Greetings all,

    I am a new subscriber to this list, and a novice Python user. Is this the
    correct place to ask for advice on Python-programming?

    I want to write a parser for BibTeX. A BibTeX file is a collection of
    entries that look like this:

    @book {Daniel04,
    title = "My Title",
    publisher = {Some publisher Inc.},
    volume = 2,
    year = 2004
    }


    Can anyone recommend a parser generator for Python? I have been
    programming for a few years, but I have never made a parser. I only have
    a vague notion of what a lexer and a grammar are. Is there a resource
    that you might recommend?

    Thanks you for your time.

    Cheers,
    --
    Daniel Carrera | No trees were harmed in the generation of this e-mail.
    PhD student. | A significant number of electrons were, however, severely
    Math Dept. UMD | inconvenienced.


  • JCM

    #2
    Re: Parsers with Python

    Daniel Carrera <dcarrera@math. umd.edu> wrote:
    ....[color=blue]
    > Can anyone recommend a parser generator for Python? I have been
    > programming for a few years, but I have never made a parser. I only have
    > a vague notion of what a lexer and a grammar are. Is there a resource
    > that you might recommend?[/color]

    I've had good luck with PLY (http://systems.cs.uchicago.edu/ply/).

    Comment

    • A.M. Kuchling

      #3
      Re: Parsers with Python

      On Tue, 17 Feb 2004 10:18:07 -0500,
      Daniel Carrera <dcarrera@math. umd.edu> wrote:[color=blue]
      > I want to write a parser for BibTeX. A BibTeX file is a collection of
      > entries that look like this:[/color]

      You should probably look at Greg Ward's btOOL
      (http://www.gerg.ca/software/btOOL/), which includes C and Perl parsers for
      BibTeX. Unfortunately the software predates Greg's use of Python, so
      there's no Python support.

      --amk

      Comment

      • Robert E. Brown

        #4
        Re: Parsers with Python


        On Tue, 17 Feb 2004 10:18:07 -0500,
        Daniel Carrera <dcarrera@math. umd.edu> wrote:[color=blue]
        > I want to write a parser for BibTeX. A BibTeX file is a collection of
        > entries that look like this:[/color]


        The cl-bibtex project implements readers and writers for BibTeX formatted
        files in Common Lisp, which is a closer to Python than C or Perl:

        Savannah is a central point for development, distribution and maintenance of free software, both GNU and non-GNU.


        Comment

        Working...