// Generated by CoffeeScript 2.5.1
(function() {
  var parse, pretty, readline, rewrite, rewriteInput, rli, unparse;

  ({parse} = require("./query-parser"));

  unparse = require("./ast-unparse");

  ({rewrite} = require("./ast-rewrite-rules"));

  pretty = require("./ast-pretty");

  rewriteInput = function(input) {
    var value;
    ({value} = rewrite(parse(input)));
    console.log(pretty(value));
    return unparse(value);
  };

  readline = require('readline');

  rli = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });

  rli.on('line', function(input) {
    return console.log(">>> " + rewriteInput(input));
  });

}).call(this);
