Add rudimentary REPL support

[Rule head inspection also]