sd & d high and low level languages

Post on 19-Aug-2015

39 Views

Category:

Education

1 Downloads

Preview:

Click to see full reader

TRANSCRIPT

High and Low Level Languages

High Level LanguagesProgramming languages are generally similar to the English

language. They use words like If, Else, Repeat, While etc.

These languages are known as high level languages.

Low Level LanguagesThe computer does not understand high level languages. It

understands binary codes which are referred to in programming as machine codes e.g. 10010010 01101010.

These languages are known as low level languages.

Low Level LanguagesMachine Code in the form of binary is extremely difficult

for humans to read. To make it (slightly) easier to read and understand, Assembly Language was devised.

Each Assembly Language command can be converted to machine code.

TranslatorsSo, humans understand high level languagesandComputers understand low level languages.

To get our high level languages into a form that the computer understands, we need a translator.

A translator converts high level language commands into low level language commands.

Interpreters and CompilersIn order to resolve this problem, there are two ways to

convert the high level language written by humans into a low level language understood by computers.

These are interpreters and compilers.

InterpretersAs the program is running, the interpreter takes one line of

code at a time and translate it into a low level code.

IF age > 18 THEN displayfield.text = “Left school”END IF

InterpretersAs the program is running, the interpreter takes one line of

code at a time and translate it into a low level code.

10011001 00010110 11000100 00010011 displayfield.text = “Left school”END IF

InterpretersAs the program is running, the interpreter takes one line of

code at a time and translate it into a low level code.

10011001 00010110 11000100 0001001110010010 11110001 00000001 1001101100110101 01111110

CompilersA compiler works by converting the program source code

and converting it into object code before the program is run.

IF age > 18 THEN displayfield.text = “Left school”END IF

CompilersA compiler works by converting the program source code

and converting it into object code before the program is run.

10011001 00010110 11000100 0001001110010010 11110001 00000001 1001101100110101 01111110

Compilers vs InterpretersInterpreters are slower than compilers when the program is

running because they have to interpret each line

The interpreter needs to be in memory each time the program is run, whereas compilers do not

Interpreters can make debugging a program easier because they can track errors line by line

Compilers have to have programs recompiled each time the code is changed, even if the change is minor

top related