La 5   Pl Translator
Upcoming SlideShare
Loading in...5
×
 

La 5 Pl Translator

on

  • 4,154 views

 

Statistics

Views

Total Views
4,154
Views on SlideShare
4,153
Embed Views
1

Actions

Likes
1
Downloads
198
Comments
0

1 Embed 1

http://nee5040.1bestarinet.net 1

Accessibility

Categories

Upload Details

Uploaded via as Microsoft PowerPoint

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    La 5   Pl Translator La 5 Pl Translator Presentation Transcript

    • PROGRAMMING LANGUAGES 5.1.4 TRANSLATOR 08042008 Prepared by: Norhasimah Mohamed, SMK Sungai Pusu, Gombak Selangor. 08042008
    • Learning Outcomes
      • 5.1.4 Translator
      • 5.1.4.1 Describe the translation method of programming using
      • i) assembler,
      • ii) interpreter,
      • iii) compiler
      Prepared by: Norhasimah Mohamed, SMK Sungai Pusu, Gombak Selangor. 04042008
    • TRANSLATOR
      • Sometimes two people cannot understand each other because they don’t speak the same language. So they need the help of a third person who understands both languages. This third person is known as a translator .
      • All software packages or programs are written in high-level languages, for example, C++, Visual Basic and Java.
      • However, in order for the computer to be able to carry out the instructions, the high-level languages must be translated into machine language before the computer can understand and execute the instructions in the program.
      • The translation of high level languages to machine language is performed by a translator.
    • TRANSLATOR
      • A programmer will write a source code which consists of the instructions
      • needed to run a program. Then the compiler or interpreter with assembler will translates the source code into machine language which is made of a sequence of bits (eg. 01100011).
      • The computer will load the machine code and run the program.
    • ASSEMBLER
      • An assembler is a computer program for translating assembly language — essentially, a mnemonic representation of machine language — into machine language.
      • For example in intel 80836, the assembly language for the ’no operation’ command is NOP and its machine code representation is 10010000.
      • Example of assemblers are MACRO-80 Assembler and Microsoft MASM.
    • ASSEMBLER
      • an assembler is used to translate assembly language statements into the target computer's machine code.
      • The assembler performs a more or less isomorphic translation (a one-to-one mapping) from mnemonic statements into machine instructions and data. (This is in contrast with high-level languages, in which a single statement generally results in many machine instructions. A compiler, analogous to an assembler, is used to translate high-level language statements into machine code; or an interpreter executes statements directly.)
      • Many sophisticated assemblers offer additional mechanisms to facilitate program development, control the assembly process, and aid debugging. In particular, most modern assemblers include a macro facility (described below), and are called macro assemblers .
    • INTERPRETER
      • Interpreter is used to interpret and execute program directly from its source without compiling it first. The source code of an interpreted language is interpreted and executed in real time when the user execute it.
      • The interpreter will read each codes converts it to machine code and executes it line by line until the end of the program.
      • Examples of interpreter-based language are BASIC, Logo and Smalltalk.
    • INTERPRETER
      • an interpreter normally means a computer program that executes, i.e. performs , instructions written in a programming language.
      • While interpretation and compilation are the two principal means by which programming languages are implemented, these are not fully distinct categories, one of the reasons being that most interpreting systems also perform some translation work, just like compilers. An interpreter may be a program that either :
      • 1. executes the source code directly
      • 2. translates source code into some efficient intermediate representation (code) and immediately executes this
      • 3. is invoked to explicitly execute stored precompiled code made by a compiler which is part of the interpreter system
      • Perl, Python, MATLAB, and Ruby are examples of type 2, while UCSD Pascal and the Java virtual machine are type 3: Java source programs are compiled ahead of time and stored as machine independent code, which is then linked at run-time and executed by an interpreter (virtual machine). Some systems, such as Smalltalk, and others, may also combine 2 and 3.
      • The terms Interpreted language or Compiled language merely mean that the canonical implementation of that language is an interpreter or a compiler; a high level language is basically an abstraction which is (ideally) independent of particular implementations.
    • COMPILER
      • The source code (in text format) will be converted into machine code which is a file consisting of binary machine code that can be executed on a computer. If the compiler encounters any errors, it records them in the program-listing file.
      • When a user wants to run the program, the object program is loaded into the memory of the computer and the program instructions begin executing.
      • A compiled code generally runs faster than programs based on interpreted language. Several programming languages like C++, Pascal and COBOL used compilers as their translators.
    • COMPILER
      • A compiler is a computer program (or set of programs) that translates text written in a computer language (the source language ) into another computer language (the target language ).
      • The original sequence is usually called the source code and the output called object code . Commonly the output has a form suitable for processing by other programs (e.g., a linker), but it may be a human-readable text file.
      • The most common reason for wanting to translate source code is to create an executable program.
      • The name "compiler" is primarily used for programs that translate source code from a high-level programming language to a lower level language (e.g., assembly language or machine language). A program that translates from a low level language to a higher level one is a decompiler .
      • A program that translates between high-level languages is usually called a language translator , source to source translator , or language converter . A language rewriter is usually a program that translates the form of expressions without a change of language.
      • A compiler is likely to perform many or all of the following operations: lexical analysis, preprocessing, parsing, semantic analysis, code generation, and code optimization.