I do something very similar to this, but just using cmake and basic bash scripts to launch the compilation and then run the executable all at once. And for the interpreter mode, a bash script can just automatically dump that into a main function, and then compile and run it all at once.
It's cool, but you can set something up like this just a few lines of bash code.