3

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!

1 Answer 1

4

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.