What's difference b/w assemblers & compilers

  • Thread starter pairofstrings
  • Start date
  • Tags
    Difference
In summary, assemblers convert input instructions to machine language, while compilers translate higher level languages to machine language. Assemblers have simple "English" to "Machine" translation capabilities, while compilers have a one to many relationship between input and output. The difference in naming reflects their different functions.
  • #1
pairofstrings
411
7
Can you tell me the differences between compilers and assemblers? why are they named different?
 
Technology news on Phys.org
  • #2
Assemblers generally convert one input instruction string to one output machine language bit pattern. They may have some higher level capabilities, such as macro expansion,but you can think of them as being simple "English" to "Machine" translators.

Compilers are the tool that translates a higher level language description, say 'C' or Fortran into machine language, so more often there is a one to many relationship between input string and output. Most compilers can output the relevant assembly language for the system, and that output may in-fact be fed into an assembler to make the machine code.

They are named differently because they do different things...
 
  • #3
Yup.
 

1. What is the main difference between assemblers and compilers?

Assemblers and compilers are both types of software that are used to translate human-readable code into machine code that a computer can understand. However, the main difference between them is the level of abstraction they operate at. Assemblers translate assembly language code, which is a low-level language that closely resembles the machine code, while compilers translate high-level languages like C++ or Java.

2. How does the translation process differ between assemblers and compilers?

Assemblers and compilers use different approaches to translate code. Assemblers perform a one-to-one translation, where each assembly language instruction is directly converted into a machine code instruction. On the other hand, compilers use a multi-step process, where the high-level code is first converted into an intermediate code, and then further translated into machine code.

3. Can the same code be translated by both assemblers and compilers?

No, the code written for assemblers and compilers is not interchangeable. Assemblers can only translate assembly language code, and compilers can only translate high-level code. This is because the syntax and structure of the code for each type of software are different.

4. Which type of software is faster - assemblers or compilers?

Assemblers are generally faster than compilers because they directly translate code into machine code without any intermediate steps. This makes them more efficient for simple and repetitive tasks. However, compilers have the advantage of being able to optimize code and generate more efficient machine code, making them faster for complex programs.

5. Do assemblers and compilers have any similarities?

Yes, assemblers and compilers both perform the important task of translating code for a computer to understand. They also both use a symbol table to keep track of variables and labels in the code. Additionally, they both have the ability to generate executable files that can be run on a computer.

Similar threads

Replies
6
Views
1K
  • Programming and Computer Science
Replies
29
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • Programming and Computer Science
4
Replies
122
Views
13K
  • Programming and Computer Science
2
Replies
59
Views
5K
  • Programming and Computer Science
Replies
17
Views
1K
  • Programming and Computer Science
Replies
4
Views
908
  • Programming and Computer Science
Replies
20
Views
2K
  • Programming and Computer Science
2
Replies
65
Views
2K
  • Programming and Computer Science
Replies
13
Views
2K
Back
Top