@stopify/normalize-js
TypeScript icon, indicating that this package has built-in type declarations

0.7.4 • Public • Published

@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.

Dependents (3)

Package Sidebar

Install

npm i @stopify/normalize-js

Weekly Downloads

1

Version

0.7.4

License

BSD-3-Clause

Unpacked Size

238 kB

Total Files

61

Last publish

Collaborators

  • arjunguha
  • joydeepb
  • jpolitz
  • emilyaherbert