Programming Language-Translators

 

Welcome to class!

In today’s class, we will be talking about programming language-translators. Enjoy the class!

Programming Language-Translators

Translators classnotes.ng

Introduction

Translators are highly developed programs capable of converting high-level language to machine language, low-level language to machine language. A translator is a computer program that performs the translation of a program written in a given programming language into a functionally equivalent program in a different computer language, without losing the functional or logical structure of the original code (the “essence” of each program).

Types of translators
  • Assembler
  • Compiler
  • Interpreter
    • If the translator translates a high-level language into another high-level language, it’s called a translator or source-to-source compiler. Examples include Haxe, FORTRAN-to-Ada translators, CHILL-to-C++ translators, PASCAL-to-C translators, COBOL (DialectA)-to-COBOL (DialectB) translators.
    • If the translator translates a high-level language into a lower-level language it is called a compiler. Notice that every language can be either translated into a (Turing-complete) high level or assembly language.
    • If the translator translates a high-level language into an intermediate code which will be immediately executed it is called an interpreter.
    • If the translator translates target/machine code to source language it is called a decompiler. Example: DCC, Boomerang Decompilers and Reverse Engineering Compiler (REC).
    • If the translator translates assembly language to machine code it is called an assembler. Examples include MASM, TASM and NASM.
    • If the translator translates machine code into assembly language it is called a disassembler. Examples include gdb, IDA Pro and OllyDbg.
    • Translators that translate from a human-readable design specified in terms of rules and high-level functions, into the equivalent logic gates and chip layout needed to achieve its manufacture, belong to electronic design automation and hardware description language categories.
Assembler:

This is a translator that is capable of converting low-level language to machine language directly. An assembler translates assembly language into machine code. Assembly language consists of mnemonics for machine opcodes so assemblers perform a 1:1 translation from mnemonic to direct instruction.
For example LDA #4converts to 0001001000100100

 

Advantages of using an assembler

  1. Very fast in translating assembly language to machine code as 1 to 1 relationship
  2. Assembly code is often very efficient (and therefore fast) because it is a low-level language
  3. Assembly code is fairly easy to understand due to the use of English-like mnemonics

Disadvantages of using an assembler

  1. Assembly language is written for a certain instruction set and/or processor
  2. Assembly tends to be optimized for the hardware it’s designed for, meaning it is often incompatible with different hardware
  3. Lots of assembly code is needed to do relatively simple tasks, and complex programs require lots of programming time
Compiler:

This is a translator that is capable of converting high-level language to machine language directly. A Compiler is a computer program that translates code written in a high-level language to a lower-level language, object/machine code. The most common reason for translating source code is to create an executable program (converting from a high-level language into machine language).

Evaluation
  1.  ____ converts high level or low-level language to machine language
    (a) transmitter (b) translator (c) transferrer (d) transducer
  2. One of these is not a type of translator
    (a) assembler  (b) compiler (c) interpreter  (d) silicon
  3. If the translator translates target/machine code to source language it is called a
    (a) machiner  (b) language (c) decompiler  (d) congester
  4. ______ is capable of converting high-level language to machine language directly. (a) assembler (b) compiler (c) interpreter (d) silicon
  5. How many stages are involved in developing a good program?
    (a) 4  (b) 5 (c) 6  (d) 7

 

In our next class, we will be talking about Programming Language-Complier and Interpreter. We hope you enjoyed the class.

Should you have any further question, feel free to ask in the comment section below and trust us to respond as soon as possible.

For more class notes, homework help, exam practice, download our App HERE

Join ClassNotes.ng Telegram Community for exclusive content and support HERE

Leave a Reply

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

Don`t copy text!