lijunsong / lambdas5 Goto Github PK
View Code? Open in Web Editor NEWThis project forked from brownplt/lambdas5
Semantics for ES5
License: BSD 3-Clause "New" or "Revised" License
This project forked from brownplt/lambdas5
Semantics for ES5
License: BSD 3-Clause "New" or "Revised" License
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.
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.
let (b=1)
let (f=func(){b:=2})
let (a=b) {
f();
a
}
f
has changed the meaning of b, no substitution should occur.
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)
try to clean
function iden(x){return x}
function iden(x){return x}
function iden(x){return x}
function iden(x){return x}
it fails ch10-nonstrict, ch11-nonstrict, ch15-nonstrict
ch10-nonstrict:
10.4.3-1-3-s.js
use βthisβ keyword in function as global variable.ch11-nonstrict
bug of less-mutation
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.