TYPES OF PROGRAMMING LANGUAGE Flashcards
What are the 2 types of programming language?
- high level languages
- low level languages
What are some examples of low level languages?
- machine code
- assembly language
What is used to translate assembly language into machine code?
an assembler
LMC instruction set (11)
- ADD (add)
- SUB (subtract)
- STA (store)
- LDA (load)
- BRA (branch always)
- BRZ (branch if 0)
- BRP (branch if positive)
- INP (input)
- OUT (output)
- HLT (end program)
- DAT (data location)
What are the 4 methods of addressing?
- immediate
- direct
- indirect
- indexed
What is immediate addressing?
- value in the address part of the instruction is the actual value to be used (so memory does not need to be searched to find that required value)
- eg: ADD 10 literally means add 10 (not add value stored in memory address 10)
What is direct addressing?
- value in the address part of the instruction refers to the address in memory where the required value is located
- eg: ADD 10 means add the value that’s located in memory address location 10
What is indirect addressing?
- value in the address part of the instruction refers to the memory location that contains the address in memory where the required value is located
- this is useful as it means larger address ranges can be used to reference data and instructions
- eg: ADD 10 means add the value that’s located in the memory address location that was stored in memory address location 10
What is indexed addressing?
- a method where the final memory address is calculated by adding a constant value (the offset) to the contents of an index register
- this allows efficient access to data stored in consecutive memory locations, such as arrays
- eg: the index register contains the value 5. the instruction ADD 10 refers to memory location 10 + 5 = 15. the CPU retrieves the value stored at memory location 15 and adds it to the accumulator (or the current working register)
What are the main programming paradigms?
- low level languages,
- object-orientated languages
- declarative languages
- procedural languages
- functional languages
What are Turing complete languages?
programming languages that can solve all problems that a computer is able to solve (most programming languages in most programming paradigms)
Why do we need different programming paradigms?
some problems are better suited to being solved using a certain paradigm
What are the 2 types of high level languages?
- imperative (focus on describing how a program operates)
- declarative (focus on describing what the program should accomplish)
What are the 2 main paradigms that fall under imperative languages?
- procedural programming
- object-oriented programming
What are features of procedural languages?
- variables
- constants
- sequence
- selection
- iteration
- subroutines
- string handling
- operators