beeware / batavia

A JavaScript implementation of the Python virtual machine.
http://pybee.org/batavia
Other
1.39k stars 424 forks source link

Compile Python into bytecode in batavia directly #294

Open swenson opened 8 years ago

swenson commented 8 years ago

In order to be self-hosted (and run without CPython also being present), we need to be able to compile Python into bytecode ourselves.

There are four big pieces to making this happen:

  1. Lexical analyzer (convert source to series of simple tokens).
  2. Write code generator for grammar to autogenerate a lot of JS for us.
  3. Implement the parser to convert tokens into an AST (with the help of the grammar).
  4. Convert the AST into Python byte code (generate).

In CPython, all of this is done in C.

alexcondrea commented 7 years ago

Anyone still working on this? Would like to contribute.

freakboy3742 commented 7 years ago

@alexcondrea @swenson was looking at this, and got as far as the lexer AFAIK; but I don't know how far he got beyond that. Chris - can you shed any light on whether you would like some help?