LambdaS5
LambdaS5 copied to clipboard
Semantics for ES5
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:
-internal-env env-vars. This option introduces identifiers of es5.env in the nested environment foreval. It has a huge negative impact on the constant propagation.-env es5.env. There are severalenvfiles in env/ directory. Optimization flags only work ones5-optimization.env, which is similar toes5.env. The only difference is that it excludes built-inevalsupport (-opt-restore-id would not work ifes5.envis used). See previous usage examples for how to pass a correct environment.