HiveBrain v1.2.0
Get Started
← Back to all entries
gotchaModerate

Is there any real difference between a compiler and an assembler?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
realanydifferencebetweenassemblercompilerandthere

Problem

Is there any difference between the two? As per Ullman's book, compilers convert one language to another (usually low level) language, and so does an assembler. How are the two different?

Solution

An assembler translates assembly code to machine code. The translation is mechanical, and can be done in only one way. In contrast, a compiler has more freedom when it compiles the relevant programming language - it can optimize, for example, and even non-optimizing compilers produce different code. Also, compilers can be written in a way that separates the "front-end" (corresponding to the programming language) and the "back-end" (corresponding to the computer architecture), whereas with assemblers the two are always the same.

Context

StackExchange Computer Science Q#13904, answer score: 19

Revisions (0)

No revisions yet.