Sha256: 39cff513fc2e43263aca8c7f4506ba60d44957849ecc53e6beca8f1587aeded3
Contents?: true
Size: 659 Bytes
Versions: 2
Compression:
Stored size: 659 Bytes
Contents
#!/usr/bin/env ruby require "interpreter" require "readline" interpreter = Interpreter.new # If a file is given we eval it. if file = ARGV.first @filename = ARGV.first.split(".")[0] File.new("#{@filename}.html", "w") interpreter.eval File.read(file) File.open("#{@filename}.html", 'a') do |f| f.puts @code.join("\n") end puts "Sweet code compiled!" # Start the REPL, read-eval-print-loop, or interactive interpreter else puts "Sweet Interactive Console, CTRL+C to quit" loop do line = Readline::readline(">> ") Readline::HISTORY.push(line) value = interpreter.eval(line) puts "=> #{value.ruby_value.inspect}" end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
sweet-lang-0.1.9 | lib/sweet.rb |
sweet-lang-0.1.0 | lib/sweet.rb |