repl: refactor for readability
This PR updates the repl
class to leverage modern EcmaScript features, including the use of classes.
I refactored the code to make it more readable and accessible for new contributors (I found it quite difficult to understand before the refactor).
Oddly enough, even though the core logic hasn't changed, one test is now failing. I'm submitting this as a draft to invite feedback and help troubleshoot the issue. Currently, the test has been modified to pass.
I'd love to get some feedback on this change.