The ability to product self-modifying code, such as by producing strings that are then executed as if they are a piece of code of said language, are trivial to do in an interpreted language, but not so much in a compiled language.
There is a reason why Python has exec()
, JavaScript has the Function()
constructor function, and Lua has loadstring()
, but C or C++ has no such equivalent. In a compiled language, the only way would be to force the language standard library to include a compiler for said language, which would bloat the language considerably. But in an interpreted language, the interpreter is already there so such constructs are trivially implemented as 'invoke the interpreter on the contents of this string.'