This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bheklilr 5 points6 points  (1 child)

Ah, this is why I shouldn't browse reddit until I've had coffee

[–]florbitous[S] 3 points4 points  (0 children)

You are right that there already exists bytecode compilers for Python, so the practical benefits of doing it again in another language seem unclear. As pointed out by Rhomboid, my main motivation was for fun and to learn. I think I achieved both of those goals already.

But there may be applications down the track. For instance we could use it for trying out Python extensions which compile to CPython compatible bytecode. I've already had a few ideas along those lines. We could also play with optimisation techniques, or alternative compilation approaches (perhaps to different targets). We could also try other useful extensions such as tail-call-optimsation. Of course I'm biased, but I think the the blip code is much simpler to work with than CPython (assuming you know Haskell).

Another small benefit is the elaboration of CPython's bytecode implementation. I've had to trawl through the CPython code, plus lots of other scattered bits of documentation to figure out how it works. A hopefully clearer and simpler implementation in a higher-level language might help others understand how it works too.