Compiler is used to translate an high level programming language code to machine level code and to create an executable program. Compiler checks the error in the program and reports them. All errors are to be removed otherwise code will not be compiled and executed.
Assembler is used to translate an assembly level code to machine readable code. Assembler too checks the correctness of each instruction and reports the diagnosis report.
Following are the important difference between Compiler and Assembler.
|1||Operation||Compiler translates high level programming language code to machine level code.||Assembler converts the assembly level language to machine level code.|
|2||Input||Source code in high level programming language.||Assembly level code as input.|
|3||Conversion type||Compiler checks and converts the complete code at one time.||Assembler generally does not convert complete code at one time.|
|4||Components||lexical analyzer, Syntax analyzer, Semantic analyzer, Code optimizer, Code generator, and Error handler||Assembler does works in two passes.|
|5||Output||Mnemonic version of machine code.||Binary version of machine code.|
|6||Examples||C, C++ , Java compilers.||GAS, GNU assemblers.|