Code Monkey home page Code Monkey logo

typhon's Introduction

Typhon is twisted Python.

A Python implementation for the Rubinius VM.

Why?

Just For Fun!.

Python is one of the most popular dynamic languagues out there, it has many projects made on it and has an outstanding number of libraries available. So I guess having an implementation for it on Rubinius would make Rubinius an strong player on VM field.

Also, the Rubinius VM is a very neat piece of software, and all the cool kids are using it to implement other languages besides ruby.

Maybe Rubinius VM does what Parrot was originally intended to. ( Running many dynamic languages )

Requirements

  • python 2
  • rubinius head
  • rake

Try it

 # Set rubinius as your current ruby.
 $ rvm use rbx

 # Get usage help
 $ ./bin/typhon --help

 # Run the hello world example
 $ ./bin/typhon examples/hello.py

 # If you want to run all the specs
 $ rake spec

 # Try -C --print-all on your python script.
 # This will most likely blow up and show you
 # a hint of what is needed to be implemented.
 $ ./bin/typhon -C --print-all your_script.py

 # You can use the --print-all switches with
 # the REPL like this:
 $ ./bin/typhon --print-all

Status

We have many simple python programs in the examples/ directory that run successfully. Of course there might be a lot of things missing, but that's were we need your help. Add an example, report an issue, or even better, submit a patch or pull request.

Roadmap

Here's the plan as its currently in my head:

  • Have a script to use Python compiler module and let it produce a sexp made of Ruby literals.

    DONE.

    bin/pyparse.py takes a Python script and outputs the AST as an array of ruby literals. The table of nodes and its attributes are read from bin/node.py. The output is just a sexp.

  • Read this sexp from Ruby and build an AST in Ruby land.

    DONE.

    rbx/ast/node.rb Typhon::AST.from_sexp takes the sexp and just creates a tree of Python AST nodes in Ruby land. The table of nodes is the same pyparse.py uses, bin/node.py

  • Write the Typhon compiler in Ruby, taking advantage of Rubinius' compiler infrastructure.

    DONE.

    We have Rubinius compiler stages at rbx/compiler/stages.rb Currently the parsing stage simply uses pyparse.py and evals the resulting sexp to later convert it to actual AST node instances.

  • Have the Typhon compiler produce Rubinius bytecode.

    IN PROGRESS.

    We add bytecode methods to AST nodes as they are being used.

  • Lots of tests.

    IN PROGRESS.

    Currently we use the scripts from examples/ directory to test that typhon and python programs produce the same output.

    Try running the example specs with

    $ mspec spec/examples_spec.rb

    Of course we need more specs without having to rely on stdout output. We're into it. Anyways ensuring all the files under examples/ work is always a good-thing(tm).

  • Investigate if the pypy project has a Python parser in Python, if so, we could use that once we compile python programs to replace the bin/pyparse.py script.

  • Bootstrap. write the Typhon compiler in Python.

Contributing

Main repository is located at http://github.com/vic/typhon report any issues you find there.

The Typhon developers hang out in the #typhon-rbx IRC channel on freenode network. If more people gets interested we might start a mailing-list.

Typhon is on its early days, if you want to help, you're more than welcome. We follow the same commit bit policy than Rubinius and Pugs, if you get your first patch accepted you get commit bit.

Coding conventions.

Set your editor to use soft-tabs at two spaces for ruby code, no hard-tabs for python code. Configure your editor to automatically remove trailing whitespace and be sure to leave an empty new-line at the end of file.

Try keep source code as readable as possible, that is, use proper indentation, an empty new-line between method definitions, skip parens in ruby where it makes sense (most if expressions), add source comments with links to python design/algorithm documents if applicable, add TODO/FIXME tags if needed.

Logo

The Typhon logo has been kindly contributed by Christoph Grabo. The logo is a derived work of the original Python logo and is distributed under a creative common license CC BY-NC-SA 3.0.

About Typhon

The name was chosen as an anagram of Python.

In greek mithology, Typhon is one of the largest and most fearsome of all creatures.

Theres a cool t-shirt showing what Typhon is all about: snakes on rbx-head

License

Modified BSD License. See LICENSE file.

Contributors

  • Christoph Grabo
  • Graham Batty
  • Joe Eli McIlvain
  • Thiago Avelino
  • Victor Hugo Borja [email protected]

typhon's People

Contributors

avelino avatar jemc avatar stormbrew avatar vic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

typhon's Issues

RoadMap Research

Your roadmap mentioned checking to see if PyPy has a parser in Python. They appear to use the built in compiler module. As it turns out, this appears to be pure Python (at least in 2.4-2.7), though I'm unclear how licensing would affect using it.

Good luck!

do we have any advance in the project ?

Hi.

Typhon appear like an interesting Python environment. I was waiting that maybe Typhon can be without GIL and with this have better performance (in the future) in the thread module and don't need the process module for real multiprocessing.

Now, is Typhon stopped in development ? I don't see any advance in commits for more than two years.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.