What does Compiler mean?
A compiler is known as a software program which easily alters the high-level source code in the machine language, written by a developer in a high-level programming language into a very low-level object code (binary code) and all of this can be grasped by the processor very easily. Therefore, the compilation is the whole process of converting high-level programming into a machine language.
The processor executes the object code, and this is an indicator once the binary high and low signals are vital in the arithmetic logic unit of the processor.
Types of compilers
The target platform is typically when the compilers have been termed by the platform on which the generated code has been executed.
A native or a hosted compiler is meant solely for working on a similar type of computer and the operating system, on which the compiler operated on. The output of a cross compiler is designed in such a way for functioning on a diverse platform. Typically, cross-compilers are utilized when the developing software for the embedded systems are not meant for providing support a software development environment.
The output of a compiler for a virtual machine, which generates the entire code (VM) may or may not be performed on the same platform as the compiler which had initially produced it. This is the primary reason why these compilers are not categorized as the native or the cross compilers.
It is quite possible that the lower level language may itself be a high-level programming language and is the target of a compiler. C, has been generally observed as a portable assembler, and can also be the target language of a compiler. E.g.: Cfront, the original compiler for C++ utilizes C as the target language. The C which has been created by such a compiler is generally not meant for the purpose of reading and is handled by the humans also. Therefore, both the indent style as well as the pretty C intermediate code are both well-thought-out to be immaterial. While there are few features of C which make it appear as an excellent target language. E.g.: C code with #line directives can be successfully generated for providing support to the debugging of the novel source.
While a common compiler type outputs machine code, there are many other types of compilers also available:
A source-to-source compiler is referred to as a type of compiler which takes a high-level language as its input and ultimately outputs a high-level language. For instance, an automatic parallelizing compiler only considers in a high-level language program as an input and later transforms the code along with interpreting it with parallel code annotations (e.g. OpenMP) or the language constructs (e.g. Fortran’s DOALL statements).
The Bytecode compilers can successfully compile to the assembly language of a theoretical machine, like Prolog implementations.
This Prolog machine is also referred to as the Warren Abstract Machine (or WAM).
Belonging to this category, the Bytecode compilers for Java, Python are also noteworthy examples.
Read here: Difference between compiler and interpreter
Some other languages, like JAVA, the applications are first compiled by utilizing a bytecode compiler and later successfully delivered in a machine-independent intermediate representation. A bytecode interpreter is then able to execute the bytecode, however, when increased performance is required, the JIT compiler helps in the translation of the bytecode to machine code.
The hardware compilers (also referred to as syntheses tools) are all those compilers whose output is a description of the hardware configuration instead of the sequence of instructions.