Presentation is loading. Please wait.

Presentation is loading. Please wait.

Introduction to programming

Similar presentations


Presentation on theme: "Introduction to programming"— Presentation transcript:

1 Introduction to programming
Translating second and third generation languages

2 The need for translation
Computers can only process data as zeros and ones, otherwise known as ‘machine code’. Therefore any programs NOT written in machine code needs to be translated. This means that all second and third generation programming languages need to be translated. ‘Source code’ is code written by the programmer and is converted into ‘Target code’ which is the machine code. Source code Translation Machine code © 2005 Bob Reeves, Dave Fogg/Hodder Murray

3 Methods of translation
There are three types of translator: the assembler: converts assembly language (second generation) one assembly language instruction converts into one binary code. the interpreter: converts high-level (third generation) languages converts one statement of source code at a time the machine code is then executed. The compiler: converts the whole of the source code into machine code the complete program is then executed. © 2005 Bob Reeves, Dave Fogg/Hodder Murray

4 Interpreters Advantages Disadvantages
It is easy to find bugs in code, as it works through the source code one statement at a time. It is particularly useful during the development process, as it allows the programmer to debug each line of code in sequence. Not much memory is needed, as it only translates small blocks of code in one go. Disadvantages Every time the code is run it will need to go through the translation process, so executing programs may be slower. If the program is run on another computer, the interpreter software will have to be installed. © 2005 Bob Reeves, Dave Fogg/Hodder Murray

5 Compilers Advantages Disadvantages
Once the code is compiled, you never have to translate it again. The code can be used on another computer without the need for translation software. Current versions of compiler software contain line-by-line debugging tools. The program will execute quicker, as it does not need to be translated as it is being run. Disadvantages It is difficult to find the source of any errors. During the development phase, any changes made mean that the whole program must be re-compiled, which can take a lot of time. © 2005 Bob Reeves, Dave Fogg/Hodder Murray


Download ppt "Introduction to programming"

Similar presentations


Ads by Google