473,387 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Can recursive descent parser handle Python grammar?

I'm a compiler newbie and was curious if Python's language/grammar
can be handled by a recursive descent parser.

Well?

Chris

Sep 28 '06 #1
4 1932
se******@spawar.navy.mil wrote:
I'm a compiler newbie and was curious if Python's language/grammar
can be handled by a recursive descent parser.
I believe a recursive descent parser can handle any grammar; it just
depends on how pure you want it to be.

--
Ben Sizer

Sep 29 '06 #2

Ben Sizer wrote:
se******@spawar.navy.mil wrote:
I'm a compiler newbie and was curious if Python's language/grammar
can be handled by a recursive descent parser.

I believe a recursive descent parser can handle any grammar; it just
depends on how pure you want it to be.

--
Ben Sizer
Thanks! What do you mean by 'pure'?

Chris

Sep 29 '06 #3
On 2006-09-28, se******@spawar.navy.mil <se******@spawar.navy.milwrote:
I'm a compiler newbie and was curious if Python's language/grammar
can be handled by a recursive descent parser.
IIUC the python grammer is LL(1) and the development team is commited
to keeping it LL(1).

LL(1) languages can be handled by a recursive descent parser.

--
Antoon Pardon
Sep 29 '06 #4
se******@spawar.navy.mil wrote:
Ben Sizer wrote:
se******@spawar.navy.mil wrote:
I'm a compiler newbie and was curious if Python's language/grammar
can be handled by a recursive descent parser.
I believe a recursive descent parser can handle any grammar; it just
depends on how pure you want it to be.

--
Ben Sizer

Thanks! What do you mean by 'pure'?
By 'pure' I mean entirely recursive and not iterative. Implementation
becomes easier if you're not writing a purely recursive parsing
program, and it makes it more practical to implement an arbitrary
amount of 'read-ahead'.

--
Ben Sizer

Oct 2 '06 #5

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

Similar topics

4
by: Magnus Lie Hetland | last post by:
Hi! I've been looking at ways of dealing with nested structures in regexps (becuase I figured that would be faster than the Python parsing code I've currently got) and came across a few...
1
by: Karalius, Joseph | last post by:
Can anyone explain what is happening here? I haven't found any useful info on Google yet. Thanks in advance. mmagnet:/home/jkaralius/src/zopeplone/Python-2.3.5 # make gcc -pthread -c...
0
by: Phlip | last post by:
C++ newsgroupies: I wrote a parser to solve math expressions like "3.0 ^(4 - 5)", or "3 / 8". Below my sig is recursiveDescentParser.cpp, the test suite that drove the implementation of the...
6
by: Phlip | last post by:
C++ newsgroupies: I wrote a parser to solve math expressions like "3.0 ^(4 - 5)", or "3 / 8". It's bad luck to name an interface after its implementation. This file could have been...
6
by: Jon Shemitz | last post by:
I just wrote my second method that reads an XML stream with XmlReader and spits out a instance of an object that represents the XML stream. In effect, this was a simple recursive descent parser...
4
by: siddharthkhare | last post by:
Hi All, I need to parse certain text from a paragraph (like 20 lines). I know the exact tags that I am looking for. my approach is to define a xml (config) file that defines what tag I am...
9
by: seberino | last post by:
I'm a compiler newbie and curious if Python grammar is able to be parsed by a recursive descent parser or if it requires a more powerful algorithm. Chris
18
by: Just Another Victim of the Ambient Morality | last post by:
Is pyparsing really a recursive descent parser? I ask this because there are grammars it can't parse that my recursive descent parser would parse, should I have written one. For instance: ...
1
by: Robert | last post by:
especially if the grammar is non-standard.
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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...

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.