Prerequisite – Language Processors: Assembler, Compiler and Interpreter
A Compiler is primarily used for programs that translate source code from a high-level programming language to a machine level language to create an executable program. A compiler will consider the entire program as a whole code and then translates. The main job of the compiler is that it checks all kinds of limits, ranges, errors, etc. Before the compiler can successfully execute the code, the errors must be removed from the source code. Example of compiled languages is C, C++, Java, C#, etc.
The Assembler takes as input the assembly code and translates it into relocatable machine code. Assembler checks each instruction for its correctness and generates a diagnostic message, if
Difference between Compiler and Assembler:
|Compiler converts the source code written by the programmer to a machine level language.||Assembler converts the assembly code into the machine code.|
|Compiler input source code.||Assembler input assembly language code.|
|It converts the whole code into machine language at a time.||But the Assembler can’t do this at once.|
|A Compiler is more intelligent than an Assembler.||But, an Assembler is less intelligent than a Compiler.|
|The compilation phases are lexical analyzer, syntax analyzer, semantic analyzer, intermediate code generated, a code optimizer, code generator, and error handler||Assembler makes two phases over the given input, first phase and the second phase.|
|The output of compiler is a mnemonic version of machine code.||The output of assembler is binary code.|
|C, C++, Java, and C# are examples of compiled languages.||GAS, GNU is an example of an assembler.|
Don’t stop now and take your learning to the next level. Learn all the important concepts of Data Structures and Algorithms with the help of the most trusted course: DSA Self Paced. Become industry ready at a student-friendly price.
- Difference between Cross-Assembler and Compiler
- Language Processors: Assembler, Compiler and Interpreter
- Difference between Native compiler and Cross compiler
- Difference between Compiler and Interpreter
- Introduction of Assembler
- Compiler Theory | Set 2
- Phases of a Compiler
- Compiler Theory | Set 1
- Why FIRST and FOLLOW in Compiler Design?
- Compiler construction tools
- Symbol Table in Compiler
- Bootstrapping in Compiler Design
- Introduction of Compiler Design
- Three address code in Compiler
- Input Buffering in Compiler Design
- Code Optimization in Compiler Design
- Peephole Optimization in Compiler Design
- Types of Parsers in Compiler Design
- Shift Reduce Parser in Compiler
- Data flow analysis in Compiler
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.