Monday, June 24, 2013


We just got Superconductor running as a web service on EC2. You no longer need to install the compiler to get started! There's still a ways to go to make this fully usable, but the hardest part is done.

Currently, the compiler service outputs unoptimized JavaScript. Send a POST request of a JSON object to our service and you'll get the synthesized layout engine:

 var src = "interface I {} class C : I { children {} attributes { var x : int; } actions { x := 1; }}";
 var myRequest = new Request({
        url: '',
        method: 'POST',
        data: JSON.stringify({
            'ftl': src,
            'target': 'js'
        onSuccess: function(text, xml) {
            console.log("received from server: " + text.length + " characters");
            if (text.substring(0,6) == "error:")
                console.error("Synthesis error: " + text.substring(6));
                console.log('result', JSON.parse(text));
Switching to this compiler service model is exciting in a few ways, but the first two important ones will be:

  1. Legacy: as the FTL language upgrades, we'll just keep legacy compilers running. You won't need to see the bitrot for running legacy files. Once the API and site mature, we'll lock it in.
  2. Multiple backends: as hinted by the 'target' field, we're going to start exposing our multiple backends. Right now the naive JavaScript one is up, and next on bat is WebCL.

To play around, I posted an interactive fiddle.

No comments: