A fork of Crisp for HARP
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 line
426 B

  1. #! /usr/bin/env crystal run
  2. require "./readline"
  3. require "./reader"
  4. require "./printer"
  5. # Note:
  6. # Employed downcase names because Crystal prohibits uppercase names for methods
  7. def read(str)
  8. read_str str
  9. end
  10. def eval(x)
  11. x
  12. end
  13. def print(result)
  14. pr_str(result, true)
  15. end
  16. def rep(str)
  17. print(eval(read(str)))
  18. end
  19. while line = my_readline("user> ")
  20. begin
  21. puts rep(line)
  22. rescue e
  23. STDERR.puts e
  24. end
  25. end