GithubHelp home page GithubHelp logo

lqc / jspy Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mstepniowski/jspy

1.0 2.0 0.0 89 KB

JavaScript interpreter in Python

Home Page: https://github.com/zuber/jspy

JavaScript 0.13% Python 99.87%

jspy's Introduction

jspy - JavaScript interpreter in Python

jspy is a toy JavaScript interpreter in Python created by Marek Stepniowski. Its implementation is directly based on ECMA-262 standard (PDF).

Installing

You'll need setuptools or distribute for installation. Then you can just run:

$ python setup.py install

You may need to have root rights, depending on your system configuration.

Usage

After the installation, jspy script should be on your path. You can then just run the script with the JavaScript file as a single argument:

$ jspy file.js

Test suite

To run the test suite, you either need Python 2.7 or the unittest2 package installed. Thankfully, setuptools will handle it for you, so you can just run:

$ python setup.py test

Source code

You can find the newest source code of jspy on GitHub.

Implemented features

  • Expressions (excluding delete, typeof, instanceof and in operators)
  • Statements (excluding for and for in loops, with, switch, labels and exception handling)
  • Functions (with nested execution scopes allowing for closures)
  • Basic object support (Object and Array literals, item assignment)
  • console.log, same as in Node.js and Firebug

Todo (in order of priorities)

  • for and for in loops
  • switch statement
  • Full object support (including an Array implementation)
  • delete, typeof, instanceof and in operators
  • Function statements
  • Sane error messages
  • Prototypal inheritance
  • Exception handling
  • Strict mode (should we run in strict mode by default?)
  • Proper value behaviour (right now the behaviour of Number and String objects is Python-like and can sometimes be different than in JavaScript)
  • Automatic semicolon insertion (as defined in section 7.9 of ECMA-262)
  • Labels for break and continue statements
  • with statement (it's evil!)

jspy's People

Contributors

anwajler avatar lqc avatar mstepniowski avatar

Stargazers

 avatar

Watchers

 avatar  avatar

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.