Possible to compile a comptime string literal?

Is it possible to (at comptime) take a string literal and compile it?

In other words, instead of defining a source file in my build.zig file, is there a way I could give it a string literal instead?

No, this is not supported and in general considered not idiomatic.

Comptime can get you already pretty far, but if you need full-blown codegen, then the correct Zig approach is to leverage the build system, not comptime.

The idea being that you have something like “output_source.zig” that you will run to create “generated_file.zig”, which then will in turn be used by your main project.

You can orchestrate this with the build system and you will also get good caching, so that the codegen step will not re-run unless you change one of the input files.