used by all bottom-up parsers. For the given grammar, E → E’ | E’ + E E’ → -E’ | int | (E) Please choose the correct shift-reduce parsing with a stack for the given input string
Shift-reduce parsing is the main strategy used by all bottom-up parsers. For the given grammar,
E → E’ | E’ + E
E’ → -E’ | int | (E)
Please choose the correct shift-reduce parsing with a stack for the given input string: int + - int
(Note that: Cursor (‘|’) denotes top of the stack, string (of tokens) to the left of the cursor are on the stack. Marker '$' is omitted for the stack and input string)
1- int|+ -int
E' +| -int
E' + -|int
E' + -int|
E' + -E'|
E' + E'|
E' + E|
E|
2- int| + -int
int +| -int
int + -| int
int + -int|
int + -E'|
int + E'|
int + E|
E' + E|
E|
3- |E' + -int
E'| + -int
E' +| -int
E' + -| int
E' + -| E'
E' +|-E'
E' +| E'
E' +| E
E'| + E
|E' + E
|E
4- int| + -int
E'| + -int
E' +| -int
E' + -| int
E' + -int|
E' + -E'|
E' + E'|
E' + E|
E|
Step by step
Solved in 2 steps