Nim is indeed a great answer for this.
Should you want to give that script a nice, traditional CLI then you can do so with very low effort using https://github.com/c-blake/cligen
Should you want "script like" edit-test development cycle ergonomics you can use the TinyCC/tcc backend for compiles in ~200..300 milliseconds. Once it's how you like it you can compile with gcc & -d:danger for max performance in deployment.