Quiz 4 Flashcards

1
Q

What algorithm do you use for bottom up parsing?

A

Shift Reduce parsing

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

What does it mean if you can generate a conflict-free parsing table for a grammar G?

A

It means the grammar is LL(1).

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

What is a conflict in an LL(1) parsing table?

A

A conflict occurs when a table entry has more than one choice, meaning the grammar is not LL(1).

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

What is non-recursive predictive parsing?

A

It is when a predictive parser runs from a table without using non-recursive predictive parsing

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

What is bottom-up parsing?

A

Bottom-up parsing constructs a parse tree for an input string starting from the leaves (terminal symbols) and works up to the root (starting symbol S).

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

What is shift-reduce parsing?

A

Shift-reduce parsing uses the shift and reduce strategy to derive the start symbol from an input string and recognizes LR grammars.

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

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

A

Shift, Reduce, Accept, and Error.

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

What happens during the Shift operation in shift-reduce parsing?

A

A token is moved from the input to the stack.

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

What happens during the Reduce operation in shift-reduce parsing?

A

When a sequence of tokens on the stack matches the RHS of a production, it is replaced with the LHS non-terminal.

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

What is a handle in shift-reduce parsing?

A

A handle is a substring that matches the RHS of a production.

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

What are the benefits of shift-reduce parsing?

A

It doesn’t require worrying about left recursion, can recognize more grammars, handle some ambiguity, and parse tables can be generated with tooling.

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

What are the limitations of shift-reduce parsing?

A

Rules are more complex and harder to understand, must be generated with tooling, memory-intensive due to large tables, and can have conflicts when minimized.

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

What types of grammars are parsed by LR parsers?

A

LR grammars.

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

What strategy do LR parsers use?

A

Shift-reduce parsing.

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

What do LR items allow a parser to do?

A

They allow the parser to know when to shift or reduce.

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

What are inadequate states in LR parsing?

A

States with shift/reduce or reduce/reduce conflicts.

17
Q

What causes inadequate states in LR parsing?

A

Issues with the grammar or inappropriate table construction methods.

18
Q

What is the key difference between LR(0) and LR(1) items?

A

LR(0) items are simpler because they have no lookahead, whereas LR(1) items are more complex because they incorporate lookahead.

19
Q

What is the key difference between LR(0) and LR(1) items?

A

LR(0) items are simpler because they have no lookahead, whereas LR(1) items are more complex because they incorporate lookahead.

20
Q

What are the different LR grammars? (6)

A

SLR, CLR, LR, LALR, LLR, GLR