4d Classification of Programming Languages
Classification of Programming Languages
- Know that there are different levels of programming languages.
- Explain the differences between low-level and high-level languages.
- Know that machine code and assembly language are considered low level languages and explain the differences between them.
- Understand that all programming code written in high-level or assembly languages must be translated.
- Understand that machine code is expressed in binary and is specific to a processor or family of processors.
- Understand the advantages and disadvantages of low-level language programming compared with high-level language programming.
Low-level Languages
Machine code
Computers only understand binary, streams of 1's and 0's.
Just about impossible for us humans to work in machine code.
Adding two numbers together in machine code, might be:
49 00 FE 49 00 FF 91 00 22 F1 00 FA D1 00 FE 91 00 22 71 00 FA A1 00 20 F1 00 1F 51 00 1F 00
Low-level Languages
To make things easier for programmers assembly language was created.
Assembly language uses basic abbreviations to hide some of the machine code.
Machine code and assembly language are the only low-level languages.
In computing we use the word abstraction to mean hide complex or unnecessary information.
Advantages of Low-Level Languages
- The programmer has complete control over the system components so it can be used to control specific hardware components.
- Very efficient code: smaller memory and usually faster than high level code.
Disadvantages of Low-Level Languages
- The programs are difficult for programmers to read and write, leading to more bugs in the software.
- Can only be written for one particular type of processor; the programmer would have to rewrite the entire program if a different processor family was required.
High-level Languages
High-level Languages
All other languages than machine code and assembly language are high-level languages.
- Python
- C++
- Java
- Visual Basic ...
High level languages all have the following characteristics:
- Selection (IF-THEN-ELSE)
- Iteration (FOR-ENDFOR, WHILE-ENDWHILE)
- Boolean operations (NOT, AND, OR)
- Identifiers (variables)
- Data structures (lists, arrays, records, ...)
Advantages of High-Level Languages
All languages, other than machine code and assembly language, are high-level languages.
- More like the language of English and Maths, so:
- Easier to learn and faster to write programs.
- Easier to read, reducing errors and faster to debug.
- Some languages are very specialised to do a specific job:
- HTML to create web pages
- SQL to create databases
Translation to Machine Code
Translation to Machine Code
Assembly Code
Machine Code
High Level Languages
Machine Code
Assembler
Compiler or Interpreter
Assembler
An assembler converts assembly language into machine code.
Typically, each different type of processor uses a different assembly language and a different assembler.
Compiler
A compiler translates a program written in a high-level language into machine code.
A program written and compiled on one type of computer would have to be compiled again to run on a computer with a different type of processor.
Code written by the programmer is called source code.
Machine code produced by the compiler is called object code.
Interpreter
An interpreter is also used to translate high-level language source code into machine code.
The interpreter translates each line of code, line by line into machine code.
Long, complex programs can be slow to execute (run) using a interpreter.
Some systems have a half-way stage (bytecode) to reduce the execute time.
The interpreter must be on the computer that is running the code.
Comparision
Compiler | Interpreter |
---|---|
Translates the whole program to produce the executable object code. | Translates and executes one line at a time. |
Complied program executes faster as it is already in machine code. | Interpreted programs take more time to execute because each instruction is translated before it is executed. |
Customers do not need to have the compiler installed on their computer to run the software. | Customers must have the interpreter installed on their computer and they can see the source code. |
Customers cannot see the actual source code when you distribute the program. | Customers can see the source code and could copy it. |
Used for software that will be run frequently or copyright software sold to a third party. | Used for program development and when programs must run on multiple hardware platforms. |
Questions
- Describe two differences between high-level code and machine code.
- Describe how an interpreter translates the high-level code into machine code.
- State the name of a different type of translator, other than the interpreter, that can be used to translate high-level code into machine code.
Questions
- Describe two differences between high-level code and machine code.
- Describe how an interpreter translates the high-level code into machine code.
High level language is hardware independent
Machine code is binary code
The compiler/interpreter converts the source code into binary, object code.
- State the name of a different type of translator, other than the interpreter, that can be used to translate high-level code into machine code.
Compiler
Classification of Programming Languages
- Know that there are different levels of programming languages.
- Explain the differences between low-level and high-level languages.
- Know that machine code and assembly language are considered low level languages and explain the differences between them.
- Understand that all programming code written in high-level or assembly languages must be translated.
- Understand that machine code is expressed in binary and is specific to a processor or family of processors.
- Understand the advantages and disadvantages of low-level language programming compared with high-level language programming.
4d Classification of Programming Languages
By David James
4d Classification of Programming Languages
Computer Science - Computer Systems - Clasification of Programming Languages and Translators
- 766