Back to: COMPUTER SCIENCE SS1
Welcome to class!
In today’s class, we will be talking about programming language-translators. Enjoy the class!
Programming Language-Translators
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
- Very fast in translating assembly language to machine code as 1 to 1 relationship
- Assembly code is often very efficient (and therefore fast) because it is a low-level language
- Assembly code is fairly easy to understand due to the use of English-like mnemonics
Disadvantages of using an assembler
- Assembly language is written for a certain instruction set and/or processor
- Assembly tends to be optimized for the hardware it’s designed for, meaning it is often incompatible with different hardware
- 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
- ____ converts high level or low-level language to machine language
(a) transmitter (b) translator (c) transferrer (d) transducer - One of these is not a type of translator
(a) assembler (b) compiler (c) interpreter (d) silicon - If the translator translates target/machine code to source language it is called a
(a) machiner (b) language (c) decompiler (d) congester - ______ is capable of converting high-level language to machine language directly. (a) assembler (b) compiler (c) interpreter (d) silicon
- 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.
Ready to make school management and growth easy? Book your free onboarding session nowGet more class notes, videos, homework help, exam practice on Android [DOWNLOAD]
Get more class notes, videos, homework help, exam practice on iPhone [DOWNLOAD]