473,516 Members | 3,064 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

best option for python lex/yacc?

mh
I'm porting a C lex/yacc based project, and would like to redo
it in python.

What's the best option for a python lex/yacc-like? I've
googled a few things, but wanted to see the current concensus.

Many TIA!
Mark

--
Mark Harrison
Pixar Animation Studios
Jun 30 '08 #1
1 5168
On Jun 30, 1:47*am, m...@pixar.com wrote:
I'm porting a C lex/yacc based project, and would like to redo
it in python.

What's the best option for a python lex/yacc-like? *I've
googled a few things, but wanted to see the current concensus.

Many TIA!
Mark

--
Mark Harrison
Pixar Animation Studios
For a full list, see http://nedbatchelder.com/text/python-parsers.html

For lex/yacc-like's, PLY, Spark, simpleparse, or ANTLR are probably
the leaders.

If you consider using pyparsing, then *don't* just try to do a
straight transliteration from your existing lex/yacc implementation -
you will end up fighting some of pyparsing's basic concepts.

But if you already have this implemented and working in C, and given
that parsing usually is such a performance-sucking operation, why not
package the existing parser into a lib, and call it from python using
ctypes, or some similar technology for embedding C code in Python?

-- Paul
Jun 30 '08 #2

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

Similar topics

18
10717
by: Moonlit | last post by:
Hi, I am searching for the best lex and yacc combination (or something similar) that can be used in combination with C++ and that can contain C++ code. I have the regular flex/bison port working but then I, of course, can't use C++ constructs in the actions. I have tried spirit although I could make a simple command line parser (after...
4
7151
by: tuxlover | last post by:
Hello everyone I have to write a verilog parser in python for a class project. I was wondering if all you folks could advise me on choosing the right python parser module. I am not comfortable with lex/yacc and as a result find myself strugging with any module which use lex/yacc syntax/philosophy. pyparser looks good to me, but before I...
4
6330
by: Profetas | last post by:
Hi. I was wondering how can I access the yacc functions? because when use a normal yacc function such as qstring { yylval.string = strdup(yytext+1); if(yylval.string !='"') warning("Undeterminated Character strig",(char *)0); else
4
4881
by: Rodrick Brown | last post by:
This might be off topic but can someone give me a quick run down on why tools like lexx/yacc/bison are usefull ? I know what there used for but not sure when they should be used and where ? Thanks. -- Rodrick R. Brown
16
636
by: | last post by:
Hi , We have a lot of code which runs fine under VC++ 6.0. We have to move to ..NET becasue one of the librairies uses .NET classes. Does every library(including those which do not use .NET classes) have to be recompiled with /clr option?. regards -sarab
13
4996
by: Berk Birand | last post by:
Hi, I am working on a school project where we use lex/yacc to write a compiler for a fictional (Java-like) language. I have handled all the details about the yacc and lex files, but I still have a question regarding the dynamic memory allocation for strings. When the lex file encounters a variable name, I want it to pass this to yacc...
2
7490
by: max.giacometti | last post by:
Hi everybody! I am using lex and yacc to write a vhdl to systemc converter. Lex simply reads the input file and yacc implements grammar and translation. I'd like to be able to make yacc able to command lex to stop reading the current file and starting reading another file, when the inclusion syntax is reached.
1
1090
by: Robert | last post by:
Or some other pre-packaged parser tool?
1
2011
by: Robert | last post by:
If the goal is to take a 1-dimensional package of text and produce a tree data structure that is easy to understand and manipulate, and then write C/C++ code that works with that tree - does lex/yacc suit that purpose - i.e. kind of like a tree-manufacturing C library? Or is it for producing a compiler/interpreter the internals of which a new...
0
7182
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...
0
7581
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...
1
7142
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5714
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...
0
3267
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...
0
3259
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1624
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
825
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
488
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.