Giter Club home page Giter Club logo

python-js-jit's Introduction

(Pretty) (naive) try to compile javascript to native code, with python.

python compiler.py script.js

Implementation

Values are represented as 32 bit integers, called BoxedInt (in v8 this is called smi): [ 31b data | 1b tag] tag: 1 = object, 0 = integer data: pointer/integer

Currently we lack any kind of memory allocator or garbage collector. If you always wanted to test some GC scheme, that's your chance, go ahead and implement it.

Only some basic operations are implemented, the most of them as so named stub calls (call to python function instead of machine code).

Variable Deceleration

 var x = 1, y; var z;

Identifier assignment (needs to be a declared variable)

 x = 'hello world';

if / conditional operator / for

 if (true) {
 }
 (x ? true : else);
 for (var i = 0; ; i++) { /* attention! never stops */
 }

(unary) plus / minus

 -1, +15, 1 + 1, x - 16.5;

increment / decrement void (used for logging)

 void 'foobar' /* would generator console output [heap object] @ 0xdeadbeef [string] "foobar" */

Array literals

 [1, 2, 3, 4];

Some other stuff that's merely an idea or doesn't work

 "".length, [].length

Credits

License

pyasm

Šī¸ 2008 by Florian Boesch [email protected]. :license: GNU AGPL v3 or later, see LICENSE for more details.

pynarcissus

Version: MPL 1.1/GPL 2.0/LGPL 2.1 The Initial Developer of the Original Code is Brendan Eich [email protected]. Portions created by the Initial Developer are Copyright (C) 2004 the Initial Developer. All Rights Reserved.

python-js-jit's People

Contributors

evilpie 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.