#!/usr/bin/env ruby require "bundler/setup" require "turmali" require "readline" require "racc/parser" stty_save = %x`stty -g`.chomp trap("INT") { system "stty", stty_save; exit } interpreter = Interpreter.new if file = ARGV.first interpreter.eval File.read(file) else puts "Turmali (#{Turmali::VERSION}) REPL, Type 'quit' or 'exit' to exit" begin while line = Readline::readline("tml >> ") exit if line == 'quit' exit if line == 'exit' Readline::HISTORY.push(line) value = interpreter.eval(line) puts "=> #{value.ruby_value.inspect}" end rescue Racc::ParseError => e puts e.inspect retry end end