1. 26
    1. 7

      I wrote this to understand bytecode compilers and interpreters. Please let me know what you think!

      1. 4

        Thanks for the mention at the end :) I haven’t touched that README in awhile, and reading over it reminded me to get cracking on that work!

        1. 3

          Of course – I am fascinated by your project and would love to find some application for OPy in my life. This was hopefully the first step in doing something related.

          1. 1

            Cool, feel free to send me any questions about it! There is a public messaging system at https://oilshell.zulipchat.com.

            Right now I don’t think OPy is that interesting, aside from being small and hackable. But if I actually manage to compile Oil down to something more efficient and compact with it, then it will be interesting!

            Basically “OPy” will be defined as “whatever collection of compiler techniques work for the Oil codebase”. That makes it very concrete and I think a pretty interesting open question. It’s also possible it will fail, but we’ll see :-/

            1. 1

              Huh, looks like I meant OVM2. I am interested particularly in having a tiny Python bytecode interpreter. Is there anything I could do to help with that?

              1. 1

                It’s hard for me to think of something specific, since there’s a lot of background knowledge required to answer that question :)

                But to be brief, I started the VM, and I would basically accept any patch that makes it run more real Python programs (and which has tests showing that). I mentioned in a blog post that it runs a toy Fibonacci. It doesn’t even implement functions or dictionaries yet, so it’s very basic, and there’s a lot to do.


                I definitely need help because finishing up OSH and implementing OVM2 is easily a year’s worth of work, and that leaves aside the Oil language. It’s not clear if there’s a good place to jump in, but we can chat about it or feel free to hack around.

                I maintain a list of issues for the broader Oil project: https://github.com/oilshell/oil/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22

                There are some small issues, as well as some larger ones that don’t require much background on Oil itself but require some knowledge in another area (e.g. fuzzing).

    2. 7

      For folks interested in this kind of stuff I recommend “Compiler Design: Virtual Machines”. It’s a pretty accessible introduction to abstract machines and their “bytecode”/semantics. Trying to implement the machines outlined in the book is a good way to understand the various paradigms and how they work under the hood. When I was on a break from work I implemented the imperative machine and it was well worth the effort.

      1. 3

        Interesting. Does this go into performance characteristics of various VM designs? Or is it more of a conceptual survey of the VM landscape?

        1. 2

          It’s more about how you’d go about designing one and what tradeoffs there are between different designs.

          1. 2

            Gotcha. Thanks for the tip, this looks like a good one to pick up.