But is it similar to how a compiler uses high level syntax to generate low level assembly code?
This is an apt comparison, actually.
Is compiling a type of automatic code generation?
This is also an apt comparison. Most modern languages are interpreted rather than compiled. C#*, Java, Ruby, Python, Perl… these all sit on top of runtimes or virtual machines such as .NET or JVM. Compilation is a process of turning human-readable language into assembly. Interpreting turns human-readable programming language into instructions for the runtime; in the case of .NET, C# gets interpreted into MSIL which tells the .NET runtime what to do, which in turn tells the hardware what to do.
Automatic code generation is more of “Hey computer, look at that code. Now translate that code to do different things, but use these templates I made.”
FWIW, compilers was two semesters in engineering school, so I’m trying to keep this discussion accessible.
*Before anyone rightfully and correctly jumps on my shit about C#, yes, I know C# is technically a compiled language.
“Ask your doctor about tacos.” https://youtu.be/zYpuuLLKQx4