Computer science: revision for unit 4
Slides in this set (6)
-
- Low level programming languages do not resemble natural languages, such as English or Welsh. They are made up entirely of bit patterns (instructions or data) that can be executed directly by the CPU.
- A high level language is a programming language that allows code to be written which is similar to a natural human language, such as English. Some programmers prefer to use high level programming languages as they are easier to understand, learn and program as commands are more English-like and identifiers can be long and meaningful.
- Low level languages are useful when speed of execution is critical or when writing software which interfaces directly with the hardware, e.g. device drivers
- High level languages are used when the execution speed is not critical, e.g. in common productivity applications, such as a word processor
-
- An Assembler is a program, which converts the low level assembly programming language into machine code.
- An Interpreter is a program, which converts code one line at a time, into machine code and executes it.
- A Compiler is a program that converts high level programs into machine code for execution at a later time (the entire program is converted, not one line at a time as with an interpreter)
- Six Stages of Compilation:
- Lexical analysis: Comments and unneeded spaces are removed. Keywords, constants and identifiers are replaced by 'tokens'.
- Symbol table construction: A symbol table is created which holds the addresses of variables, labels and subroutines.
- Syntax analysis: Tokens are checked to see if they match the spelling and grammar expected, using standard language definitions. This is done by parsing each token to determine if it uses the correct syntax for the programming language If syntax errors are found, error messages are produced.
- Semantic analysis: Variables are checked to ensure that they have been properly declared and used. Variables are checked to ensure that they are of the correct data type, e.g. real values are not being assigned to integers. Operations are checked to ensure that they are legal for the type of variable being used, e.g. you would not try to store the result of a division operation as an integer.
- Code generation: Machine code is generated.
- Code optimisation: Code optimisation may be employed to make it more efficient/faster/less resource intense
-
- A Syntax error is when you type some invalid code.
- It is easy to fix because the compiler/interpreter can tell you exactly where the error is, meaning syntax errors are pretty simple to solve.
- A Runtime error is when your code is valid, but attempts something that can’t be done while running
- An interpreted language (for example, python) can tell you where the error occurred. However, compiled code can't do that.
- A Logic error is when your code has no errors, but doesn’t do what you wanted.
- These logic errors are quite hard to fix because there is no error actually generated. The code works fine, however it does not work as the user wants it to (meaning there is an error in the code which has caused this but its logical - no actual syntax or runtime mistake)
-
- IDE = Integrated Development Environment
- An integrated development environment (IDE) is an application used to create software. An IDE can often support different languages.
- IDEs have a number of different tools and functions that assist a developer in the creation of software.
- An IDE is used to write code, test for errors and translate a program IDEs are text editors with extra features designed to make programming easier.
- These features COULD include:
- > editor
- > automatic formatting
- > trace
- > syntax error detecting
- > memory inspector
- And many more... Note that, very few IDES actually provide ALL of these features.
-
- An operating system manages hardware and software for a computer providing common services for computer programs.
- The operating system manages many resources, such as:
- Manages peripherals such as input and output devices
- Manages printing using spooling
- Manages backing store
- Manages memory (RAM)
- Manages processes
- Manages security
- > Multi-tasking is where a processor appears to be doing two tasks simultaneously
- > An interrupt is a method to immediately pause execution of all processes and execute a new one The OS will manage interrupt requests, backing up existing processes so they can be resumed when the interrupt is finished
- > A process is a running application
- > Backing stores are storage devices used to keep backups of important files
- > A peripheral is a device that connects to a computer, such as a printer or game controller
- > Operating systems use device drivers to communicate to different peripherals A device driver maps the operating system’s commands to the device’s commands
-
- Print Spooling: If the program needs to print a document, the user tells the operating system to print it. The operating system will then spool the print job (it will keep it in a queue until the printer is ready). This means my program doesn’t need to worry if the printer is busy or unplugged or out of ink.
- Interface: An interface is the mechanism by which the user controls the functions of the computer
- Most operating systems support two types of interface: A GUI (Graphical user interface) and A CLI (Command Line Interface).
Information
- Description
- Slide Set on Computer science: revision for unit 4, created by Lydia Deane on 06/05/2021.
- Created by
- Lydia Deane
- Views
- 1
- Rating