473,804 Members | 2,048 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Jul 18 '05 #1
3 1306
JCM
Daniel Carrera <dc******@math. umd.edu> wrote:
....
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?


I've had good luck with PLY (http://systems.cs.uchicago.edu/ply/).
Jul 18 '05 #2
On Tue, 17 Feb 2004 10:18:07 -0500,
Daniel Carrera <dc******@math. umd.edu> wrote:
I want to write a parser for BibTeX. A BibTeX file is a collection of
entries that look like this:


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
Jul 18 '05 #3

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

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:

http://savannah.nongnu.org/projects/cl-bibtex/

Jul 18 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
6065
by: Will Stuyvesant | last post by:
There seems to be no XML parser that can do validation in the Python Standard Libraries. And I am stuck with Python 2.1.1. until my web master upgrades (I use Python for CGI). I know pyXML has validating parsers, but I can not compile things on the (unix) webserver. And even if I could, the compiler I have access to would be different than what was used to compile python for CGI. I need to write a CGI script that does XML validation...
2
3939
by: Thomas Guettler | last post by:
Hi! What are the difference between xml.parsers.expat and xml.sax? Up to now I used xml.sax.make_parser and subclass from ContentHandler. I think xml.sax.make_parser uses expat as default. Why should I want to use xml.parsers.expat?
2
1172
by: Maurice LING | last post by:
Hi, I am using PLY (Python-Lex-Yacc) to write my parsers. However, it seems to me that PLY is using comments (especially multiline comments) in the Yacc component such as def p_expression(p): '''expression : term PLUS term''' ....
0
1330
by: eparker | last post by:
Hello! I'm new to this list, so please be gentle. :) I've been scouring the net for an answer to this, as well as trying to get a little demo running, but to no avail, so I'm going to plead some help from the court, about a multithreading C++, which embeds Python parsers.. Hopefully I'm dumb, and it's an easy answer. :) So, here goes:
2
1489
by: Dale Strickland-Clark | last post by:
A few days ago there was a discussion about which XML parser to use with Python. However, the discussion didn't cover validating parsers, at least, not w3.org XML Schemas. I looked into all the parsers that came up in the discussion but found no mention of w3.org schemas. It seems there are a few DTD validating parsers but that's all.
2
3744
by: dwelch91 | last post by:
Hi, c.l.p.'ers- I am having a problem with the import of xml.parsers.expat that has gotten me completely stumped. I have two programs, one a PyQt program and one a command line (text) program that both eventually call the same code that imports xml.parsers.expat. Both give me different results... The code that gets called is (print statements have been added for debugging):
0
3194
by: JosAH | last post by:
Greetings, welcome back at the sequel of the parsers article chapter. This part is dedicated to the ExpressionParser, the largest parser class for our little language. This class parses a complete expression and just like the other parser classes calls the Generator on the fly. When the parse has completed successfully, the generated code is returned. Otherwise the parse is aborted and an exception is thrown telling the reason of the...
0
3383
by: JosAH | last post by:
Greetings, this week's article part discusses the parsers used for our little language. We will implement the parsers according to the grammar rules we defined in the second part of this article. As you will see shortly, the implementation of the parsers is an almost one-to-one translation of those grammar rules. Recursive descent parsing The grammar rules are highly recursive, i.e. one rule mentions another rule
1
4223
by: josh logan | last post by:
Vincent Yau <y...@ohsu.eduwrites: Fast-forward to 2008 I installed Python 3.0b2 on a Windows Vista laptop (after having previously installed Python 2.5), and I am getting this same error: Traceback (most recent call last): File "Programming\Python\monkeys.py", line 24, in <module> test_parse(sys.argv)
0
9716
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9595
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10354
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10101
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9177
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6870
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5536
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3837
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.