Bottom up parser Flashcards

1
Q

what is the difference between top down parser and bottom up parser ?

A

S –> Ab
top-down parser :
pop S into the stack then the right-hand side
left most derivation

bottom-up parser
pop the Ab then the left-hand side(S)
right-most derivation

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

bottom-up parser action :

A

reduce :
A -> Ba replacing the eight hand side by A
| a | | A |
| B | ==> | . |
|__ | |__|
shift :
reads the terminal from the input and put it on the stack

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

what are possible conflicts we can face

A

Reduce Reduce problem :
| A | and two rules B -> A / C -> Ab the parser gets
| b | stuck which rule he should reduce
|__ |
Shift reduce conflict: it gets stuck whether it keeps shifting or reducing

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

viable prefix

A

the prefix of a right sentential for that that occur during a successfull right-most derivation

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

how to extract viable prefix in a given automata

A

the prefix of a right sentential for that that occur during a successful run of the bottom parser, and can be extracted during the build of CFSM

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

LR 0 parser rules

A

at all the time we want a viable prefix on the stack
associate a config to each state of CFSM
at each step, we run CFGM on the stack content
Associate actions to each CFGM state A-> a. reduce otherwise, shift

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

what is the unrealistic things about LR 0 parser

A

the fact that we need to feed the content of stack CFSM, however, it can be treated through inserting the state number

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

what are the limitations of LR0?

A

it can lead to conflicts

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

SLR 1

A

it’s

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