I built something like this that compiled BASIC to C or C++ to avoid dealing with the later. Later re-implemented it in LISP. Doing a one-to-one mapping from LISP to 3GL code makes it easier than some here think. Using a correct-by-construction coding method eliminates a <i>lot</i> of the problems. Your code generator can also avoid C-related errors and undefined behavior wherever possible with tools available to check for most of both. Mine was a simplistic tool with very-few targets in terms of compilers. <i>Great</i> safety and productivity, though.<p>Here&#x27;s main benefits a LISP-like C can give you:<p>1. Automate boilerplate
2. Automate safety
3. 4GL-style doing very much with very little
4. Context-specific optimizations
5. My favorite: interactive testing &amp; incremental compilation for sub-1s code-to-execute and maximizing mental flow. Safe, C alternatives will probably never be able to do this.
6. Update while the system is running if still in prototyping mode. Fun stuff.
7. Save exact execution state of mock C application for debugging if you design that feature.<p>I don&#x27;t recall most of details of implementation due to a broken memory. I worked in industrial BASIC more than C because C has too many issues. However, as &quot;dang&quot; and &quot;jhack&quot; are into this, I&#x27;ll add that I did find it useful as a non-compiler-expert to setup at least two versions or states of the development environment: prototyping and production.<p>The prototyping system was designed for interactive development. It had all the libraries I might use loaded up, pre-wrapped, and with interface checks. The 3GL commands, or emulation of them, ran instantly as LISP expressions. You develop in this mode with no connection to the 3GL except logical and [mostly] semantic equivalence. Your code is straight up code at the moment.<p>When done with that, you switch to production where your code is data that&#x27;s interpreted and turned into the 3GL. The generator should take care to make portable code or at least cover your targets. Throw in out-of-bounds checks and such by default. Can have a declaration to decide that. Anyway, you get your BASIC, C, C++, whatever code here. I can even imagine one for Rust that works faster than the actual compiler.<p>So, two versions of the system: interactive interpretation, incremental compilation, and live updating of LISP version for quick development w&#x2F; optional checks inside (eg typing); version that generates code for external compilers. Both operate on same input but ignore what they don&#x27;t need. Can avoid most debugging issues with a robust, coding style and plenty interface checks. All I did with that.<p>Hope lessons from that old project helps someone doing the next. I expect if I recreate it that the Amplifying C stuff will be helpful in figuring out how to do that. So might be tools like Racket and me learning LISP <i>for real</i>. ;)