Git Product home page Git Product logo

lambdas5's Introduction

Semantics for ECMAScript 5.0
============================

Install and Usage
-----------------
See `INSTALL` for installation instruction.

s5 options are implemented as stack manipulation so the order of
options matters. Here are a few examples (in `src/` directory, and a
js file `test.js` exists):

Desugar a Javascript program and print the S5 source.

    $ ./s5.d.byte -desugar test.js -print-src

Desugar a Javascript program, wrap with an Environment and do evaluation.

    $ ./s5.d.byte -desugar test.js -env ../envs/es5.env -apply -eval

Desugar a Javascript program, wrap with an Environment, apply
optimizations and finally print out the optimized code (excluding the
environment).

    $ ./s5.d.byte -desugar test.js -env ../envs/es5-optimization.env -apply -opt-restore-id -opt-restore-function -opt-propagate-const -opt-clean-deadcode -print-user-s5

Slimming Language Options
-------------------------

All optimization options start with "-opt-". There are a few options
not compatible with the optimization flags:

1. `-internal-env env-vars`. This option introduces identifiers of
es5.env in the nested environment for `eval`. It has a huge negative
impact on the constant propagation.
2. `-env es5.env`. There are several `env` files in env/
directory. Optimization flags only work on `es5-optimization.env`,
which is similar to `es5.env`. The only difference is that it excludes
built-in `eval` support (-opt-restore-id would not work if `es5.env`
is used). See previous usage examples for how to pass a correct
environment.

lambdas5's People

Contributors

blerner avatar etanter avatar int3 avatar jonahkagan avatar jpolitz avatar justinpombrio avatar labichn avatar lijunsong avatar mjc1283 avatar progval avatar

Stargazers

 avatar

Watchers

 avatar  avatar

lambdas5's Issues

multiple assignment removing

try to clean

function iden(x){return x}
function iden(x){return x}
function iden(x){return x}
function iden(x){return x}

convert assignment return undefined

for a whole program function iden(x) {return x;}, convert assignment transforms the program like this:

let (%fobj3 = ...)
   iden := %fobj3
let (iden = ...)
  undefined

This changed the return value.

function arity optimization

var o = { get foo() { return this; } } 
return o.foo===o;

Because o.foo will supply another object to the function foo: o["foo", {[]}]. Getter should not be changed(getter does not take arguments anyway)

improve has_side_effect

for a given expression, if the SetBang is on an id that is bound in the expression, the predicate should return NoSideEffect. Example expression:

let (y=1) {
  y:=2;
  let (z = 2) {
    z := 3
  }
}
=> NoSideEffect

propagate copy bugs

let (b=1)
     let (f=func(){b:=2})
          let (a=b) {
            f();
            a
          }

f has changed the meaning of b, no substitution should occur.

preprocess->less-mutation failed test

it fails ch10-nonstrict, ch11-nonstrict, ch15-nonstrict

ch10-nonstrict:

  • [nonstrict mode] 10.4.3-1-3-s.js use β€˜this’ keyword in function as global variable.

ch11-nonstrict

  • [bug] S11.8.6_A2.4_T1.js
  • [bug] S11.8.6_A2.4_T1.js

bug of less-mutation

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.