Common Lisp
(setq *debugger-hook* (lambda (a b) (abort)))
(set-macro-character #\( (lambda (stream char)
(read-delimited-list #\) stream)
(values)))
Step one is to disable the debugger. I do this by binding the *debugger-hook*
(which is called immediately before entering the debugger) to a function which cancels whatever tried to enter the debugger in the first place. Then, I turned (
into a comment character- everything up to its matching close paren is completely ignored. I cache the existing function used to parse lists in *old-paren*
so I don't have to reimplement the logic for parsing lists just to comment them out.
The result, tested on sbcl at the repl (both line-by-line and #'load
ing it from a file), is a repl which completely ignores any meaningful code. Literal values (number, strings, symbols, etc.) work just fine, but anything else is just ignored.