0.7.4 • Published 3 years ago

@stopify/normalize-js v0.7.4

Weekly downloads
6
License
BSD-3-Clause
Repository
-
Last release
3 years ago

@stopify/normalize-js

This package implements a semantics-preserving transformation for JavaScript that is inspired by A Normal Form ^1. The transformation guarantees that:

  1. All applications are named, unless they are in tail position. (A flag can be set to name applications in tail position too.)
  2. All loops are while loops.
  3. All branches are if statements.
  4. No declarations are hoisted.
  5. All variables are declared before use.
  6. No continue statements exist.

The transformation does introduce new break statements and labelled statements.

Using This Tool Independently

  1. In the root of the repo:

    $ yarn
  2. Then in this directory:

    $ yarn run build
  3. Then run!

    node ./dist/ts/main.js <filename>

^1: 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.