Code generation
From open-encyclopedia.com - the free encyclopedia.
In computer science, the code generation is a compilation stage that outputs machine code in the target language.
Code generators usually take intermediate form generated by directly semantic analysis or intermediate code generators. Three address code format is a common intermediate format, described in fact in the dragon book. It also refers to one of the trial generations in genetic programming
In more general sense, the code generation is to produce programs in some automatical manner, reducing need for human programmers to write code manually. A compiler-compiler, a program that generates a compiler like yacc, is a very common instance.
Code generations can be done either at runtime, including load time or compiler time. Just-in-time compilers usually produce native or nearly native code from byte code when programs are loaded onto the compilers. Compiler-compilers, for instance, almost always generate code at compiler time on the other hand.
A preprocessor is an example of the simplest code generator.
See also model-driven architecture, compiler, programming language, semantic analysis.