Introduction of Compiler Design

Introduction of Compiler Design

  • Compiler: Compiler is a software which converts a program that is written in high-level language to low level language .

compileProcess.jpg

  • Language Processing System: We all know that computer only understands binary format, but as a human, it is so hard for us to write our program in such binary format. So we are our program in a high-level language and then we use some mechanism to convert our high-level program into binary format or machine level code. This whole process is called Language Processing System.

cd12.png

  • Part of Language Processing System:

    • Preprocessor: The preprocessor includes all header files and also executes MACRO if it is included. So preprocessor takes source code as input and produces modified source code as output. And this part is not necessary to be included in all languages because in some languages there is no need to include header files and MACRO. So it is optional.

    • Compiler: The compiler takes the modified code as input and produces the target code as output.

    cd.png

    • Assembler: The assembler takes the target code as input and produces real locatable machine code as output.

    • Linker: It takes the collection of object created by Assembler and Compiler and combine them into executable code.

    • Loader: The loader keeps the linked program in the main memory.

    • Executable code: It is the low-level and machine-specific code and machines can easily understand. Once the job of linker and loader is done then object code finally converted into the executable code.

  • Note: We are not discussing all the topics, we just focus on the compiler from the next article. If you want to focus on other topics also you can google it and learn about it. Your suggestion and feedback are welcome.