views:

46

answers:

1

I want to learn about compilers and some optimization techniques, and I thought it would be helpful to do some quick implementations of the algorithms.
Is there a library/framework for Python that can make things easier (like the Natural Language Toolkit) - generating the parse tree, manipulating loops, methods?

I saw that Microsoft Research has a library named Phoenix, but it's intended for C++ and I would like to avoid writing prototypes in C++, it's too much work.

Thanks in advance!

+3  A: 

As far as I know, there is no Python module to do what you want. But you can create structures by yourself in Python, or use PyPy and write your compiler with JIT enabled features in RPython. If you really want to test some algorithms, I highly recommend you to use LLVM, it is in C++, but is the currently state-of-art platform to experiment such things that you're willing to do. LLVM has a lot of optimizations (where you can learn a lot) and a nice tutorial on how you can implement your own, its API is very simple and clean. There is bindings for Python too if you want, but only for LLVM 2.6. Give LLVM a try, it's a worth reading and you'll learn a lot with tutorials like this.

Tarantula