Recursive descent algorithm able to parse Python?

Gabriel Genellina gagsl-py at yahoo.com.ar
Thu Sep 28 22:29:58 EDT 2006


At Thursday 28/9/2006 17:00, Michael wrote:

>seberino at spawar.navy.mil wrote:
>
> > 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.
>
>Python is relatively simple to parse using a recursive descent parser. If
>you're rolling your own as a learning exercise, the grammar for python is
>included in one of the top level directories of the source distribution for
>python.

And it will stay so. From PEP 3099: "The parser won't be more complex 
than LL(1). Simple is better than complex. This idea extends to the 
parser. Restricting Python's grammar to an LL(1) parser is a 
blessing, not a curse. It puts us in handcuffs that prevent us from 
going overboard and ending up with funky grammar rules like some 
other dynamic languages that will go unnamed, like Perl."



Gabriel Genellina
Softlab SRL 


	
	
		
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya! 
http://www.yahoo.com.ar/respuestas




More information about the Python-list mailing list