Compare the Difference Between Similar Terms

Difference Between

Home / Technology / IT / Programming / Difference Between Assembler and Compiler

Difference Between Assembler and Compiler

June 28, 2011 Posted by Indika

Assembler vs Compiler

In general, compiler is a computer program that reads a program written in one language, which is called the source language, and translates it in to another language, which is called the target language. Traditionally, source language was a high level language such as C++ and target language was a low level language such as Assembly language. However, there are compilers that can convert a source program written in Assembly language and convert it to machine code or object code. Assemblers are such tools. So, both assemblers and compilers ultimately produce code that can be directly executed on a machine.

What is a Compiler?

Compiler is a computer program that reads a program written in one language, which is called the source language, and translates it in to another language, which is called the target language. Most often, the source language is a high level language and the target language is a low level language. So, in general compilers can be seen as translators that translate from one language to another. In addition, compilers perform some optimizations to the code. A typical compiler is made up of several main components. The first component is the scanner (also known as the lexical analyzer). Scanner reads the program and converts it to a string of tokens. The second component is the parser. It converts the string of tokens in to a parse tree (or an abstract syntax tree), which captures the syntactic structure of the program. Next component is the semantic routines that interpret the semantics of the syntactic structure. The code optimizations and final code generation follow this.

What is an Assembler?

Assembler is a software or a tool that translates Assembly language to machine code. So, an assembler is a type of a compiler and the source code is written in Assembly language. Assembly is a human readable language but it typically has a one to one relationship with the corresponding machine code. Therefore an assembler is said to perform isomorphic (one to one mapping) translation. Advanced assemblers provide additional features that support program development and debugging processes. For example, the type of assemblers called macro assemblers provides a macro facility.

What is the difference between an Assembler and a Compiler?

Compiler is a computer program that reads a program written in one language and translates it in to another language, while an assembler can be considered a special type of compiler which translates only Assembly language to machine code. Compilers usually produce the machine executable code directly from a high level language, but assemblers produce an object code which might have to be linked using linker programs in order to run on a machine. Because Assembly language has a one to one mapping with machine code, an assembler may be used for producing code that runs very efficiently for occasions in which performance is very important (for e.g. graphics engines, embedded systems with limited hardware resources compared to a personal computer like microwaves, washing machines, etc.).

Related posts:

Difference Between Debugger and Compiler Difference Between Source Program and Object ProgramDifference Between Source Program and Object Program Difference Between Compiler and Interpreter Difference Between Algorithm and Pseudocode Difference Between Binary Search and Linear Search

Filed Under: Programming Tagged With: abstract syntax tree, Assembler, assembly language, Compiler, components of compiler, high level language, isomorphic translation, lexical analyzer, machine code, macro assemblers, object code, parse tree, parser, semantic routines, source language, target language

About the Author: Indika

Indika, BSc.Eng, MSECE Computer Engineering, PhD. Computer Science, is an Assistant Professor and has research interests in the areas of Bioinformatics, Computational Biology, and Biomedical Natural Language Processing.

Comments

  1. Salman hasan ghazi says

    September 9, 2021 at 7:23 am

    very good and informative

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Request Article

Featured Posts

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and Cold Symptoms

Difference Between Coronavirus and SARS

Difference Between Coronavirus and SARS

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Influenza

Difference Between Coronavirus and Covid 19

Difference Between Coronavirus and Covid 19

You May Like

Difference Between Iso and Sec in Organic Chemistry

Difference Between Iso and Sec in Organic Chemistry

Difference Between Motorola Xoom and Galaxy Tab 8.9

What is the Difference Between Sore Throat and Dry Cough

What is the Difference Between Sore Throat and Dry Cough

Difference Between Ecotype and Ecophene

Difference Between Ecotype and Ecophene

Difference Between HCG Drops And Injections

Latest Posts

  • What is the Difference Between Osteoporosis and Scoliosis
  • What is the Difference Between Saree and Half Saree
  • What is the Difference Between Hypernatremia and Hyponatremia
  • What is the Difference Between Diabetes Mellitus and Diabetic Ketoacidosis
  • What is the Difference Between Sciatica and Spinal Stenosis
  • What is the Difference Between Metatarsalgia and Morton’s Neuroma
  • Home
  • Vacancies
  • About
  • Request Article
  • Contact Us

Copyright © 2010-2018 Difference Between. All rights reserved. Terms of Use and Privacy Policy: Legal.