Fork me on GitHub

part of the Shift suite

Shift Code Generator

generates an ECMAScript program from a valid Shift AST


In this demo, a script is provided, and the formatted code generator output is shown when the pretty button is pressed below. When the minimal button is pressed, a minimal code generator provides the smallest possible output, not including minimizer rewriting.

for( let x ;x> 5;x ++){if (x<3){do { console.log(`${x} < 3`); } while (false)} else { console.log(`${x} >= 3`); }}


npm install shift-codegen


import codegen from "shift-codegen";
let programSource = codegen(/* Shift AST */);