1
1
123qwe2015-11-16 20:50:20
Programming
123qwe, 2015-11-16 20:50:20

What is the difference between Assembler and Compiler?

This question is asked in one of the computer science books at the end of the chapter on programming languages.
As I understood the above, it is that the assembler is essentially an assembly programming language code assembler that translates it into a machine language.
A compiler is also a kind of translator of the code of 3rd generation languages ​​into machine code.
The only difference I see is that assembly instructions are very close to machine code, and these instructions are machine dependent, while high-level language instructions are essentially at a fairly high level of abstraction, and the compiled code is machine independent.
All information is in English, and some points are not entirely clear.
I'm clearly missing something. Help.

Answer the question

In order to leave comments, you need to log in

6 answer(s)
O
Oleg Tsilyurik, 2015-11-16
@Olej

What is the difference between Assembler and Compiler?

By and large - nothing!
It's like comparing a BMW to a car in general... which is better?
An assembler (in the sense of a program, not a language) is a compiler from assembly language to machine code.
A compiler is the same, but from any language ... there is no compiler at all, there is a "compiler from language X", "compiler from language Y" ... "compiler from assembly language" ;-)

M
Max, 2015-11-16
@MaxDukov

assembler - a translator of the source code of a program written in assembly language into a program in machine language. From the language (what a surprise) - assembler. Which is already almost machine code - a low-level language.
But the compiler is a translator (essentially a translator) from a high-level language often into a low-level language (in the same Asm, for example)

M
Mrrl, 2015-11-16
@Mrl

Everything is correct. You can also add that a compiler can compile a high-level language program into assembly language code - and at the same time it will remain a compiler. Then the assembler program will be able to convert this code into a system-dependent object file. They don't do that now, but it used to be a perfectly valid way to style a compiler.

A
AlbertUfa, 2015-11-16
@AlbertUfa

The programming language of the type is assembler (assembly language).
This is a kind of compromise between wordless machine (binary) codes and verbose commands in human language (mnemocodes), supplemented by text links to memory cells. Assembly language and machine code are often confused because they are simply different ways of representing the same program. Each assembly language operator corresponds to a certain numerical (machine (binary)) code.
Compiler
(compiler) i.e. a program that converts (high-level) language statements into machine codes. Like an assembler, the compiler reads the source file character by character, dividing it into words, operators, and numbers. Writing a compiler is, of course, much more difficult than writing an assembler. An assembler statement translates into a single machine code, while a high-level language statement typically translates into many machine instructions.
"Code. The secret language of computer science" Charles Petzold.
There used to be several manufacturers of processors for computers. As a result, each manufacturer had its own assembler. In the Intel line, he had his own, motorola and others had their own. Everything seems to be standardized now.

A
Adamos, 2015-11-16
@Adamos

Assembler is a one-to-one translator: there is an instruction - there is a machine code corresponding to it.
The compiler is a complex meat grinder: it not only reduces everything that was written in a high-level language to low-level instructions, but also optimizes the code - by unrolling short functions, for example, to avoid the cost of calling them.
And at the same time, it checks the code for syntax compliance and basic logic, issuing the appropriate errors and warnings ...

O
OnYourLips, 2015-11-16
@OnYourLips

A compiler is also a kind of translator of the code of 3rd generation languages ​​into machine code.
No, the mention of the 3rd generation is superfluous here.
A 2nd or 4th generation language translator will also be a compiler. Therefore, an assembler is a special case of a compiler.
However, a very dubious article in the Russian Wikipedia does not agree with this point of view.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question