written 2.8 years ago by |
What is Compiler?
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.
What is Assembler?
An assembler is a type of computer program that interprets software programs written in assembly language into machine language, code and instructions that can be executed by a computer. An assembler enables software and application developers to access, operate and manage a computer's hardware architecture and components. An assembler is sometimes referred to as the compiler of assembly language. It also provides the services of an interpreter.
COMPILER | 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. |