computer languages computer languages machine language machine language assembly language assembly...

11

Upload: angela-shepherd

Post on 21-Jan-2016

254 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language
Page 2: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

Computer Languages Machine Language Assembly Language High Level Language Translation Compiler

Page 3: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

To write a program for a computer, we must use a computer To write a program for a computer, we must use a computer language. A computer language is a set of predefined words language. A computer language is a set of predefined words that are combined into a program according to predefined that are combined into a program according to predefined rules (rules (syntaxsyntax). Over the years, computer languages have ). Over the years, computer languages have evolved from evolved from machine languagemachine language to to high-level languageshigh-level languages..

Page 4: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

In the earliest days of computers, the only programming languages available were machine languages. Each computer had its own machine language, which was made of streams of 0s and 1s. The only language understood by a computer is machine language.

Page 5: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

The next evolution in programming came with the idea of replacing binary code for instruction and addresses with symbols or mnemonics. Because they used symbols, these languages were first known as symbolic languages. The set of these mnemonic languages were later referred to as assembly languages.

Page 6: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

Although assembly languages greatly improved programming efficiency, they still required programmers to concentrate on the hardware they were using. Working with symbolic languages was also very tedious, because each machine instruction had to be individually coded. The desire to improve programmer efficiency and to change the focus from the computer to the problem being solved led to the development of high-level languages.

Over the years, various languages, most notably BASIC, COBOL, Pascal, Ada, C, C++ and Java, were developed.

Page 7: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

Programs today are normally written in one of the high-level Programs today are normally written in one of the high-level languages. To run the program on a computer, the program languages. To run the program on a computer, the program needs to be translated into the machine language of the needs to be translated into the machine language of the computer on which it will run. computer on which it will run. To change a program we write in a high level language into a low level language we use a program called a translator

There are 2 types of translator program we can use:◦ Interpreters◦ Compilers

Page 8: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

1. A compiler normally translates the whole source program into the object program.

2. Source program is in machine language.3. Object program is in High level language. 4. These work by translating the whole program at once (the

object code) and saving the compiled low level version (the source code).

5. This can be slow to use when creating programs as even if an error is found the whole program is translated.

6. Once a completed program is translated it can be run over and over again without the need to retranslate.

Page 9: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

machine Language High level language

Compiler

Page 10: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

1. Some computer languages use an interpreter to translate the source program into the object program.

2. Interpretation refers to the process of translating each line of the source program into the corresponding line of the object program and executing the line

Page 11: Computer Languages Computer Languages  Machine Language Machine Language  Assembly Language Assembly Language  High Level Language High Level Language

A computer interpreter works much like a human interpreter:

1. It translates a single line of the program at a time.

2. Each line is then run by the computer as it is translated.

3. This is done every time the program is run.

4. This allows errors to be located quickly when making a program but can be slow when running a finished program.