What is the difference between an assembler and a compiler ?
Answer Details
Both an assembler and a compiler are translator programs, but they operate on different starting points. Assembly language sits just above raw machine code and uses short mnemonic instructions such as ADD or MOV that correspond closely to the processor's own instruction set, while a high-level language such as Python or C uses English-like statements far removed from machine instructions.
An assembler takes source code written in assembly language and converts it directly into machine language that the processor can execute. A compiler performs a similar conversion but starts from a high-level programming language, translating the entire program into machine language before it is run. The key distinction is therefore the starting language each tool accepts, assembly language for the assembler and a high-level language for the compiler, while both ultimately produce machine language as their output.
When comparing these two translators, focus on what each one takes as input rather than what it produces, since both end in machine code but start from very different kinds of source code.