The Middle End Flashcards

1
Q

What is a statically checked programming language?

A

A programming language that performs type checking at compile time

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

What is a dynamically checked programming language?

A

A programming language that performs type checking at run time

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

What is the symbol table often stored as?

A

A hash table

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

A lot of programming languages allocate and initialise a symbol table for each scope

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

What are the different types of Internal Representation (IR) ?

A
  • Graphical (structural)
  • Linear

-Hybrid

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

What is a graphical internal representation?

A

Uses a node and edge structure to create the internal representation, tends to be close to source code

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

What is linear internal representation?

A

An internal representation that uses pseudo code for some abstract machine. Typically close to target code.

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

What is a hybrid internal representation?

A

A combination of a graphical and linear approach to internal representation

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

How would you convert a parse tree to an abstract syntax tree?

A
  1. Traverse the parse tree in post order
  2. Remove non-terminal symbols
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Why do we convert from a parse tree to an abstract syntax tree?

A

The parse tree contains a lot of unnecessary information

The AST is a near source-code level representation

Easily generate source code, perform an in order traversal

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

What are some issues with abstract syntax trees?

A
  • They use a lot of pointers for traversals and transformations
  • memory intensive
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How does a linear representation work?

A

We use three address codes,

where every statement is a single operator, and contains at most three operands

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

What are auxilliary graph representations?

A

These representations do not represent the full code, instead they represent properties of the code.

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

Name 3 auxiliary graph representations

A

Control Flow Graph
- models the way that the code transfers control as a result of conditional or loop statements

Data Dependence Graph
- encodes flow of data

Call Graph
- shows dependencies between procedures, which functions may be calling other functions

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

What do the nodes and edges of a control flow graph represent?

A

Node = a single basic block (a maximal straight line of code)

Edge = a transfer of control between basic blocks

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

What do the nodes and edges of a data dependence graph represent?

A

Node = a program statement

Edge = connects two nodes if one uses the result of the other