koehlma / jaspy
- понедельник, 18 апреля 2016 г. в 03:13:27
JavaScript
a Python VM written entirely from scratch in JavaScript with some unique features
Jaspy is a Python VM written entirely from scratch in JavaScript with some unique features. Jaspy supports multiple threads, comes with an integrated debugger which offers remote debugging and provides a flexible preprocessor based architecture. Speed is explicitly not a main goal of this project. Jaspy aims to illustrate how web programming on the client side could be done by exploring new ways.
Jaspy comes with an integrated development server and interactive debugger!
First clone the repository and build the interpreter:
git clone --recursive https://github.com/koehlma/jaspy.git; cd jaspy
python3 build.py # compile the interpreter
Install dependencies for the interactive console, if they are not installed already:
pip3 install --user -r requirements.txt
pip3 install --user ptpython pygments
Switch to the example directory and start the server in interactive mode:
cd example
PYTHONPATH=../ python3 -m jaspy.cli --interactive
Visit http://localhost:8080/hello.html in your browser and click run:
There are already many other Python-to-JavaScript approaches out there:
Most of them are faster than Jaspy but none of them offers the unique features of Jaspy, which are the fully suspendable interpreter with threading support, the integrated debugger and the flexible, preprocessor based architecture.
This project is still in an alpha state. The APIs are unstable, it is untested and not ready for productive use. Some of the features listed above aren't yet implemented.
If you like the ideas of Jaspy feel free to join, there are many things to do:
libs: | third-party dependencies |
---|---|
modules: | bundled native JavaScript modules |
src: | JavaScript source files (need to be preprocessed) |
jaspy: | Python server, converter and remote debugger |
Many thanks to the Brython project for the inspiration for many parts of code of the builtin-classes. Many thanks also to the book “500 Lines or Less” which is a good starting point if you want to know how the interpreter works.