Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
executable file 22 lines (19 sloc) 574 Bytes
#! /usr/bin/env iced
{evaluate,Environment} = require './lib/interpreter'
esprima = require 'esprima'
toplevel = ->
repl = require 'repl'
env = new Environment
eval: (cmd, ctx, filename, callback) ->
evaluate (esprima.parse cmd[1..-2], loc: true), env, callback, (e) ->
callback("Error: #{e}")
{argv} = require 'optimist'
if argv._.length < 1
fs = require 'fs'
ast = esprima.parse (fs.readFileSync argv._[0]), loc: true
evaluate ast, new Environment, (->), (e) ->
console.log "Error: #{e}"
process.exit 1
Something went wrong with that request. Please try again.