title: Library/Compiler to use continuations in JavaScript
body: <p>I am looking for a JavaScript library/compiler that allows developers to use continuations like found in Scheme (or Rhino). For example, this library should allow us to do some similar to:  </p>
  
  <pre><code>var kont;
  function add(x,y) {
    return x +
          (function() {kont = new Continuation(); return y;})();
  }
  
  var executed = false;  //avoiding infinite recursion
  show(add(5,1));        //show 6
  
  if (!executed) {
    executed = true; 
    kont(20); // show 25 because the "y" binding is changed
  }  
  
  var result = cont(20); 
  </code></pre>
  
  <p>The main points behind this code are: a) to capture and b) resume the control flow (or execution) of a JavaScript script. In order to resume the execution, I suppose the "capture" should be a first-class value like 'kont = new Continuation()'</p>
  
  <p>I searched for libraries, but I only found jwacs (<a href="http://chumsley.org/jwacs/" rel="nofollow noreferrer">http://chumsley.org/jwacs/</a>), but this project to be discontinued. Sadly, Babel (<a href="https://babeljs.io/" rel="nofollow noreferrer">https://babeljs.io/</a>) does not support it :(.             </p>
  
  <p>Any help?</p>