# Taken from http://lukaszwrobel.pl/blog/math-parser-part-3-implementation
require 'rubygems'
require 'expression_parser'

parser = ExpressionParser::Parser.new

loop do
  begin
    print '>> '
    puts parser.parse(gets)
  rescue RuntimeError
    puts 'Error occured: ' + $!
  end
end
