Midterm Questions Flashcards

1
Q

What machine does a lexical analyzer use?

A

Deterministic Finite Automaton

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

What kind of language does a DFA recognize?

A

Regular Languages

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

What makes context free grammar ambiguous?

A

More than one parse tree for a string

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

What do we call a computer where the compiled code runs?

A

Target machine

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

What is a sentential form?

A

A string of terminals and non terminals

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

What kind of machine does a parser use?

A

PDA (Pushdown Automata)

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

Can an NFA be simulated by a DFA?

A

Yes

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

What do we call the input of the compiler?

A

Source program

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

What is the input of a lexical analyzer? Output?

A

Input: character stream
Output: token stream

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

Why do we need/use first and follow sets?

A

To form lookahead, to avoid backtracking

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

Can a regular language contain(as a proper subset of it) a non regular language?

A

Yes

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

Which parse method recognizes the most CFGs?

A

Generalized parsing, CYK

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

Does lexical analyzer need lookahead?

A

Yes

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

Why is regular expression to mDFA pipeline important?

A

Automates a very tedious, error prone procedure. We want automatic language translation

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

What are the compiler stages in order?

A

Lexical Analysis
Syntax Analysis
Semantic Analysis
Intermediate code generation
Code optimization
Code Generation

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

What were the first language translators called

A

Assembly language

17
Q

Do parsers recognize languages or grammars?

A

Grammars

18
Q

Chomsky Hierarchy in order:

A

Type 0: Recursively Enumerable
Type 1: Context Sensitive
Type 2: Context Free
Type 3: Regular Languages

19
Q

Formal Definition of a DFA

A

5-Tuple:
(Q, Σ, δ, q0, F) states, alphabet, transition function, start, accept states

20
Q

Do NFAs and DFAs (pushdown automata) recognize the same set of languages?

A

Yes

21
Q

Do tokens partition the set of lexemes accepted by the lexical analyzer? (Think project 1)

A

Yes

22
Q

What is the working definition of a compiler?

A

Turns source language into target language

23
Q

What is the input and output of a syntax analyzer?

A

Input: token stream
Output: parse tree

24
Q

What is an alphabet?

A

A set of characters or symbols

25
Q

Name 2 state machines.

A

DFA and NFA