Quizzes Flashcards

1
Q

In a Chomsky Hierarchy, what automata(acceptors) go with each level?

A

Type 0: Turing Machine
Type 1: linear bounded
Type 2: push-down automata
Type 3: finite automata

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

Definition of a Grammar

A

4-Tuple:
(V, Σ, R, S): Set of non-terminals, terminals, set of productions, start symbol

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

A computational machine is considered non deterministic if a given current state and an input symbol, there is exactly one choice for the next state.

A

False

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

What is the order of the RE to mDFA pipeline

A

RE → Thompson’s Construction → NFA → Subset construction → DFA → Hopcroft’s Algorithm →mDFA

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

A syntax tree is an ordered, rooted tree that represents the syntactic structure of a string of sentence generated by a formal grammar.

A

True

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

What are the two types of top-down parsers (discussed in class)

A

Recursive descent, predictive

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

What is left recursive grammar?

A

A grammar containing productions of form A → Aα

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

Left derivation

A

Process of generating a string by replacing at each step the left-most non-terminal

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

A context-free language that is generated by no unambiguous grammar is:

A

Inherently ambiguous

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

Follow set

A

If A is a non terminal, then it is the set of terminals that can follow A in some sentential form

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

First set

A

If α is a sentential form, then it is the set of terminals that can begin a string derived from α

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

Broadly, what does a parser need in order to do its job?

A

Production rules, token stream, stack

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

What are the grammars at each level of Chomsky’s hierarchy? Can also be asked as what are the production rules?

A

Type 0: α → β
Type 1: αAβ → αγβ
Type 2: A → α
Type 3: A → aA, A → a

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

What are the different LR grammars?

A

LR, LLR, LALR, GLR, CLR, SLR

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

It is easy to generate bottom up parsing by hand T/F

A

False

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

What algorithm is used for bottom up parsing?

A

Shift-Reduce Algorithm

17
Q

What are the four operations of a shift-reduce parser?

A

Shift, Reduce, Accept, and Error.

18
Q

T/F First and Follow can used in bottom-up parsing

A

T

19
Q

Every DFA is an NFA? What about the reverse?

A

DFA → NFA : True
NFA → DFA: False