How does the compiler identify its hardware to the host machine? Which component?

My teacher told me that the intermediate code is common across all systems, but the compiler component makes it different according to the system / environment in which the code is executed. Can someone explain this.

+3


source to share


1 answer


Usually the compiler is divided into two parts: the interface, which performs the parsing, and which generates intermediate code. Then a backend that takes intermediate code and generates assembly or machine code.

The frontend can be generic, but the backend is built for a specific purpose. Thus, the compiler does not have to "identify" the host, only the target.



Please note that host and target can be different systems that cross-compile .

+7


source







All Articles