pystachio


Python-to-JavaScript translator in JavaScript

Pystachio is an early-stage Python-to-JavaScript translator (written in JavaScript) aimed at providing Python scripting in any modern browser.

Example page using Pystachio (Live demo): ``` Pystachio test page body { font: normal 16px sans-serif; }

This is an example of inline Python.

    <!-- embedded python -->
    <!-- note: leading whitespace on the first code line counts as the starting point for indentation -->
    <script type="text/python">
    <!--
        temp = "hello, world!"
        def something(temp):
            return temp
        print something(temp)
    #-->
    </script>

    <!-- pystachio must be started after all Python is on the scene -->
    <script type="text/javascript">
    <!--
        //init params: debug_mode
        pystachio.init(true);
    //-->
    </script>
</body>

```

Benefits

  • Let's you code in Python instead of (or along with) JavaScript in the Web browser
  • Could potentially be used as an offline Python-to-JavaScript translator by running it from the command-line

Notes!

  • So far Pystachio only implements a tokenizer for Python.

Project Information

Labels:
python javascript web-applications translator