Compiler Construction VO Flashcards

1
Q

What is the usual general flow

A

Source program → compilation (errors) → Target program

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

Classification

A

Single-pass, multi-pass, debugging or optimizing

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

Optimization - test

A

compile the program first, then with optimization
result should be the same

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

Concept of compilation - Phases

A

Splitting into two phases

1 ANALYSIS: split into tokens and then generate intemediate code (code from which you can extract information)
2 SYNTHESIS: close to the machine, uses the intermediate code to generate the target program

resuable: e.g. nalysis phase remains the same, can be reused

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

Analysis - overview

A
hierarchical structures (trees) storing syntactical information that comes from the source program
used also for: structure editors, pretty printers, static checkers, web browser, interpreters, …
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Analysis - flow

A

skeletal source program → preprocessor → source program → [compiler → target assembly language → assembler → relocatable machine code

after that (by the operating system):

relocatable machine code → loader/linker-editor → absolute machine code

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

components of a compiler

A

source code

lexical analyzer
syntax analyzer
semantic analyzer
intermediate code generator
code optimizer
code generator

target code

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

lexical analysis

A

sequence of characters are converted to tokens

Tokens:

identifier
assignment symbols
operators

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

Syntax analysis

A

grammatical analysis
based on rules of grammar
taking tokens (based on symbols)

generating parse tree where we see how the derivation of the grammar rules is done

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

Semantic analysis

A

check for semantic errors

type checking

example: conversion between types

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

intermediate code generation

A

representing the original program

usually done via three-address code (three is the maximum number of adresses)
using symbol table

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

Code Optimizer

A

Goal: faster machine code
e.g. combinig things together, …

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