4.6 Classification of Programming Languages Flashcards
What languages are low-level languages?
1) Machine Code: Lowest level of code written in 1’s and 0’s
2) Assembly Language: Programming using mnemonics e.g. LDR, STR
Low-Level Languages: Machine Orientated
What languages are high level? IOD
1) Imperative Languages: Typing in lists of instructions (subroutines) that a computer follows
2) Object Orientated Languages: Creating objects where the instructions and data are contained inside of the object
3) Declarative Languages: Describing a program rather than stating how to solve it
E.g. SQL
What is machine code?
Machine code is the only code that a computer can understand, it is made up of a pattern of 1’s and 0’s
What is Assembly Language?
Assembly language is a more user-friendly way to code as it uses words over O’s and 1’s
How are machine code and assembly language connected?
Assembly language is essentially machine code but with words, each command in assembly language is translated directly into machine code
1 to 1 Relationship
What is an Assembler?
An assembler translates source code into machine code
What are the Advantages of Machine Code and Assembly Language over High-Level languages?
1) Programs executed quickly
2) Program code is relatively compact
3) Assembly language allows for manipulation of registers which increases controlability
What is the relationship between imperative language and low-level languages?
They both use instructions in their code that are translated
What translators are used for what types of language?
1) Assembler translates Low-Level Languages
2) Interpreter and Compiler High-Level Languages
What is the role of the Interpreter?
The interpreter reads the statement of source code and it immediately performs the required action such as calling the routines or interpreting the syntax
What is the role of the compiler?
The compiler converts the whole source code into object code before its executed
Benefits:
1) Fast execution time once object code has compiled the file doesn’t need to be executed again
2) Once compiled you no longer need the compiler
Drawbacks:
1) One small change to the code can take a long time to debug
2) Object code only runs on a computer on the same platform
3) Errors are reported at the end of the compilation
Designed for code that is specific to a platform e.g. code specific to 32 bits Linux processor to run on 64 bit Windows processor you would need to convert it
What is bytecode?
1) Bytecode is an instruction set that is executed using a virtual machine
2) Byte code is used as the virtual machine can emulate the architecture of a computer
3) Any source code can be translated into an executable format if it is written in byte code
e. g. Java
What is the difference between source code and object code?
1) Source code has not yet been compiled into an executable file
2) Object code is compiled code that can be run on any computer with the same CPU architecture
What are the Advantages of High-Level Languages over low-level languages?
1) They have built-in functions such as libraries
2) Built-in functions such as the print function (the programmer doesn’t need to know how the print statement works the complexity of it is hidden)
3) Easier to use than low-level languages complexity hidden
What are the benefits and drawbacks of Interpreters?
Benefits:
1) Code can be translated one statement at a time
2) Used during program development
3) Run on processors with different instruction sets
Drawbacks:
1) Each line needs translating each time so program execution times can be high
2) Source code is only translated not executed
3) For users to run the code they must have the interpreter installed