repl implementation