@stopify/normalize-js
This package implements a semantics-preserving transformation for JavaScript that is inspired by A Normal Form 1. The transformation guarantees that:
- All applications are named, unless they are in tail position. (A flag can be set to name applications in tail position too.)
- All loops are while loops.
- All branches are if statements.
- No declarations are hoisted.
- All variables are declared before use.
- No continue statements exist.
The transformation does introduce new break statements and labelled statements.
Using This Tool Independently
-
In the root of the repo:
$ yarn
-
Then in this directory:
$ yarn run build
-
Then run!
node ./dist/ts/main.js <filename>
-
Cormac Flanagan, Amr Sabry, Bruce F. Duba, and Matthias Felleisen. The Essence of Compiling with Continuations. In Proceedings of ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), 1993.
↩