I realized you can run C programs in memory with TinyCC (which is much thiner than Clang/LLVM but the generated code is less optimal)
Setup: git clone https://github.com/TinyCC/tinycc cd tinycc ./configure make cd ../ Run See example here (tcc_run.nim, tcc.nim wraps tcc lib): <https://gist.github.com/guibar64/5a5a028587fe961bc54816de7007006d>