Python grammer and student projects

logistix at cathoderaymission.net logistix at cathoderaymission.net
Thu Jun 5 16:28:10 EDT 2003


> 
> This semester I've to conduct a lecture about compiler-building 
> (german: Compilerbau) with some exercise. And this exercise tries to 
> develop a hand-crafted Python compiler without using tools like lex and 
> so on. My opinion is, that the resulting compiler can't compete by far 
> with any other Python compiler, especially that from python.org. It's 
> only for teaching the students how to develop a compiler "by hand" and 
> how much work it is ;-)
> 

There is a pure-python compiler that comes with python
(/Lib/Compiler).  It's about 40x slower than the builtin compiler.  It
also uses the builtin parser.

I wrote a handcoded parser a few months ago.  It took less than a week
parttime.  Plugging this in made the python compiler about 60x slower
than the builtin one.  Available here if you're interested.

http://www.cathoderaymission.net/~logistix/python/pparser.py

You might also be interested in Pypy at http://www.codespeak.net/ 
They're trying to write the whole runtime environment in pure python.




More information about the Python-list mailing list