6, 7, 8. Programs Flashcards

1
Q

What happens in syntax analysis (2)

A
  • Each statement is checked against the assembler’s rules of syntax
  • Parsing happens
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is parsing

A

Systematically breaking down tokens(/statements) into their (grammatical/syntax) component parts e.g. variable to check their syntax is correct

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What happens in semantic analysis (3)

A
  • Variables are checked to ensure they are the correct data type
  • Variables are checked to ensure they’ve been properly declared
  • Operations are checked that they are legal for the data type used (you can’t divide a string)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is optimisation

A

Attempting to reduce the program’s execution time

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Linking error definition

A

When a function/library can’t be found

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Run-time error definition

A

Occurs when program is run - program is asked to do something it can’t, making it crash (e.g. saving something in a file that hasn’t been created)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Interpreter definition

A

A program that analyses the source code line by line and converts it into machine code (line by line)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Can the program run without the interpreter (when it’s being used)?

A

The program can only run if the interpreter is present

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Interpreter advantages

A

✅allows for easier program development - errors can be corrected as program is interpreted
✅lines of code can be modified as its run

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

5 stages of compilation

A

1 lexical analysis
2 syntax analysis
3 semantic analysis
4 code generation
5 optimisation

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What happens in lexical analysis (3)

A

➡️ all comments and spaces are removed
➡️all keywords, Constants and identifiers are replaced by tokens
➡️a symbol table is created with holds the addresses of variables, labels and subroutines

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Assembler definition

A

A program that converts low-level language programs (e.g assembly language) into executable code

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How does an assembler work

A

Each mnemonic is replaced by the corresponding binary machine code instruction

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Compiler definition

A

A program that translates a complete program written in a high level language (source code) into machine code in one go

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

How does a compiler work (3)

A

Each high level language instruction is converted into many low level ones
The compiled program can be loaded into memory and can run independently from the compiler
List of errors produced at the end

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Advantages of a compiler

A

Compiled program runs faster than interpreted program. It checks all lines of code not just the ones being executed

17
Q

Trace role

A

Displays order in which line of a program are executed and the values of variables as the program is running

18
Q

Break point role

A

Interrupts a program at a specific line allowing programmer to check a variables current value against expected value

19
Q

Variable watch role

A

Displays current value of any variable

20
Q

Single stepping

A

Allows code to be executed line-by-line, the programmer deciding when to move on so they can examine the program carefully as its run

21
Q

Memory inspector

A

Displays contents of a specific section of memory

22
Q

Error diagnostics role

A

Displays error messages- helps programmer understand what’s wrong

23
Q

IDE definition

A

Integrated development environment
Software to help with software engineering by providing tools to do so

24
Q

Editor role

A

Allows programmer to enter and edit source code and design an interface

25
Q

Compiler definition

A

Converts source code into machine code. Once compiled, can run multiple times

26
Q

Interpreter role

A

Converts each line of code into machine code and executes it as it goes- performs each time code is run

27
Q

Linker role

A

Allows sections of code (functions etc) to be linked together

28
Q

Loader role

A

Loads previously compiled machine code into memory

29
Q

High level language definition

A

Resembles human language
Allows use of powerful commands that perform complex tasks- functions

30
Q

High level language advantages

A

Easier to understand, learn and program
can be run on different programs
Commands can be meaningful and complex

31
Q

Low level language definition

A

Machine oriented, made of bit patterns that can be directly executed by CPU

32
Q

Low level language advantages

A

Very fast, minimum amount of storage storage needed

33
Q

Lowest level of low level language

A

Machine code