Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Systems Nat 5 Computing Science

Similar presentations


Presentation on theme: "Computer Systems Nat 5 Computing Science"— Presentation transcript:

1 Computer Systems Nat 5 Computing Science
Translation of high-level program code to binary (machine code)

2 Lesson Aims By the end of this lesson:
All pupils will be able to describe: A program Machine Code High Level Languages Why High Level Languages require translation How interpreters and compilers function

3 What is a program? A set of instructions that a computer can understand Programs are written in computer languages The languages that we will learn about are:- High-level languages Machine code

4 Machine code The computer’s own language
Programs written in machine code just contain 1’s and 0’s Difficult:- for people to understand To edit To find errors Machine code programs are each suited to a particular processor i.e. not portable

5 High level languages Computer languages that use English words to write programs e.g. Visual Basic Easy to:- understand edit find errors High Level Language programs can run on a variety of computers without being changed i.e. they are portable

6 Examples of High Level Languages
Use Scratch Learn to program Visual Basic COMAL C++ Create applications, operating systems and games HTML Create web pages JAVA Internet programming

7 The need for translation
Nat 5 The need for translation Computers only understand machine code A translator program translates high-level languages programs into machine code The machine code instructions can then be executed by the processor

8 How an interpreter works
Nat 5 How an interpreter works Translates one line of the high-level language program into machine code then executes it Translates the next line then executes it etc… Translation takes place each time the programs is run

9 Features of interpreted programs
Error messages are reported as the program is developed Interpreter must be in memory for the program to run Program runs slow as translation takes place during execution

10 How a compiler works Translates the entire high-level language program (source code) into a machine code program (object code) The machine code (object code) program is saved and can be run without the need for it to be translated again

11 Features of compiled programs
Error messages only reported after the whole program has been compiled and object code produced Compiler does not need to be in memory for the object code to run Object code runs quickly as no translation is needed Source code must be kept incase the program needs to be edited

12 Developing a program An interpreter is usually used while a program is developed as the error reporting is useful When the programs works it is compiled to produce a machine code program that is saved It could be compiled a number of times to create machine code programs to suit a variety of processors – so it can be sold to more customers

13 A thought about efficiency…
For counter = 1 to 10 picOutput. Print “Hi” Next Interpreter – 30 lines of code are translated every time the program is run Compiler – 3 lines are translated once and stored

14 Summary Machine code:- understood by computers, contains only 1’s and 0’s High-level languages:- use English words, easy to understand, must be translated Interpreter:- translates then executes a HLL line then translates and executes the next, etc Program runs slowly and is translated each time it’s run. Interpreter must be in memory when program runs Compiler:- translates source code into object code which is saved. Object code runs quickly without the compiler being in memory

15 Questions Name two high-level languages and state their uses.
What is a translator program? Name two types of translator programs. What is source code? What is object code?

16 More questions Which translator program produces object code?
Which translator program must be in memory when the program is run? Which type of translator is used if you want to create a program that runs fast? Why must source code be kept after compilation?


Download ppt "Computer Systems Nat 5 Computing Science"

Similar presentations


Ads by Google