bin/tml in turmali-0.0.1 vs bin/tml in turmali-0.0.2

- old
+ new

@@ -1,31 +1,21 @@ #!/usr/bin/env ruby -# The Turmali language! -# -# usage: -# ./tml example.tml # to eval a file -# ./tml # to start the REPL -# -# on Windows run with: ruby -I. tml [options] require "bundler/setup" require "turmali" - require "readline" interpreter = Interpreter.new -# If a file is given we eval it. if file = ARGV.first interpreter.eval File.read(file) - -# Start the REPL, read-eval-print-loop, or interactive interpreter else - puts "Turmali REPL, CTRL+C to quit" + puts "Turmali (#{Turmali::VERSION}) REPL, Type 'quit' or 'exit' to exit" loop do - line = Readline::readline(">> ") # 1. Read + line = Readline::readline(">> ") + exit if line == 'quit' + exit if line == 'exit' Readline::HISTORY.push(line) - value = interpreter.eval(line) # 2. Eval - puts "=> #{value.ruby_value.inspect}" # 3. Print - end # 4. Loop - + value = interpreter.eval(line) + puts "=> #{value.ruby_value.inspect}" + end end \ No newline at end of file