WEEK 2.10 Flashcards
programming/coding
consists of instructing a computer to perform tasks
program/algorithm
sequence of instructions which maniputes data
coding languages
way of communicating with computer to code
low-level language
language whose instructions are close/identical to processor’s own instructions
high-level language
language whose instructions resemble English and are far from the computer’s own language
translation method from high-level language to computer
- compilers
- interpreters
compiler
translate whole program into machine code, then program can be executed
interpreters
translate and execute program into machine code, one instruction at a time
trade-off between instruction set size and program length
the larger the instruction set of a language, the smaller the size of a program for a given task
low-level language instruction set size
small
high-level language instruction set size
large
simplest coding language
- Hao Wang’s register machine
- only three instructions: Inc, Deb, End
- sufficient to process any computation
register machine
idealised, imaginary (and perfectly possible) computer that consists of nothing but a finite number of registers and a processing unit
registers
memory locations where numbers are stored
Inc n,m
increase value of register by n and go to step m
Deb n,m,p
if value of register is n>0, decrease value of register by 1 and go to step m, else go to step p
End
end the program
special purpose language
domain specific, can only carry out a restricted set of tasks specific to that domain (e.g. HTML)
general purpose language
domain neutral, can carry out any computable task (e.g. Python), Turing complete
Turing complete
allow the creation of programs that can emulate any machine
control structures
- instructions that control program’s behaviour and flow
- 2 types: selection and repetition structures
selection structures
- produce decisions and branching
- employ logical condition
- e.g. if-then
repetition structures
produce loops where the same part of the code runs more than once over distinct values (e.g. for, while)
Python
- general-purpose programming language that comes with both an interpreter and a compiler
- widely used because allows users to code easily and simply
libraries
- made up of modules
- used by programming languages
- offer supplementary collections of functions