Monday 12:10 p.m.–12:55 p.m.
Building An Interpreter In RPython
- Audience level:
To understand how dynamic programming languages get executed I set out to build a PHP interpreter. Not a joke, I really did it and it worked! The final result was a well-tested piece of Python code, which could be compiled to be very performant as well. The goal of this talk is to introduce you to the basics of interpreters and the tools available in RPython to build one.
To understand how dynamic programming languages get executed I set out to build a PHP interpreter. Not a joke, I really did it and it worked! The final result was a well-tested piece of Python code, which could be compiled to be very performant as well. It's available as an open source project on github [http://github.com/juokaz/pyhp](http://github.com/juokaz/pyhp). The talk has these major sections: * what is an interpreter in theory > This covers topics like why C is compiled and Python is interpreted, what is the role of an interpreter, what does JIT do and what is the pipeline of executing Python/Ruby/PHP or any other dynamic code. This alone is very valuable as it helps to understand the performance behavior of ones code, and for example the importance of strict types. * what is RPython and how it works > Everyone has heard of PyPy, but a lot of people are unaware about the underlying RPython framework. Thus this is goes through the functionality provided by it, why it is good for using for interpreters and not for general code. The key takeaway is that RPython looks like Python code and can be executed as one, but at the same time compiled to a very fast binary. * how it was used for implementing PyHP > My story on why I chose to build a PHP interpreter and the experience I had while doing so. PHP has some unique traits of functionality and this also covers the challenges of implementing them. Yet at the same time it explains why it was so easy to make the whole language Unicode-first in a single commit. * where to start to build an interpreter yourself > Outside of understanding what interpreters are, and what is RPython, this talk will show the basics (also available on github) on how to build an interpreter for a simple language. This is a fun and challenging project to do, and will provide a better understanding of the internals of Python or any other dynamic language.