Programming languages

<< Previous: Boolean logic test Next: IDEs >>

Classification of languages

Programming languages can be categorised as:

Low level languages

Low level languages include machine code, which is binary, and assembly language. Machine code is processor specific, meaning the code for a particular instruction in one processor may not be the same as the code for the same instruction in another. Assembly languages use mnemonics to represent commands e.g. STO for store and INP for input. Low level languages give very close control over the functioning of the processor.

High level languages

High level languages use words from natural language e.g. if, while, for. A program written in a high level language, referred to as source code, must be converted to machine code before the computer can execute it. High level languages include Python, Javascript, C.

High vs low level languages

Machine code executes quickly because it doesn't need to be translated first. However, it very difficult to write in machine code compared to a high level language which uses natural English. One command in a high level language may translate to several low level commands e.g. num1 = num1 + 1 is three commands: load num1; add 1; store as num1. High level languages are limited to the existing set of commands where as any command can be constructed from the low level commands in assembly language.

Translators

Translators are used to convert high level code and assembly code to machine code so it can be executed. Assembly code is translated by an assembler. High level code can be converted by either:

Compiler

A compiler takes the source code, written in a high level language, and converts it to object code all at once. Object code is machine code that can be executed and run very fast because it requires no further translation.

Interpreter

An interpreter translates code one line at a time and executes the translated line of code immediately.





Knowledge check


Questions:
Correct:

Question text


<< Previous: Boolean logic test Next: IDEs >>

© All materials created by and copyright S.Goff