-1
$\begingroup$

I've been researching the different answers I've been given to this, would somebody just be able to give me a clear answer of the difference between

Shift, reduce and go-to. - In a parsing table.

Of course, reduce is in the same, but how do you know when to shift or go-to?

Thanks.

$\endgroup$

closed as unclear what you're asking by vonbrand, David Richerby, Evil, Discrete lizard, Yuval Filmus May 7 '18 at 9:33

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    $\begingroup$ Welcome to Computer Science! The title you have chosen is not well suited to representing your question. Please take some time to improve it; we have collected some advice here. Thank you! $\endgroup$ – Raphael May 2 '18 at 5:46
  • $\begingroup$ Which parsing algorithm? What have you tried and where did you get stuck? $\endgroup$ – Raphael May 2 '18 at 5:46
  • $\begingroup$ The terms are used in slightly different ways in some parsing algorithms. Study the explanation of the algorithm you have in ming closely, and ask again with specific questions about it. $\endgroup$ – vonbrand May 2 '18 at 13:44
1
$\begingroup$

Goto is what you do after a reduce. It's very like a shift, except that it is handlng a non-terminal while shift handles a terminal.

A reduce action removes some items from the stack and uses them to create a non-terminal, which must then be pushed ("shifted") onto the stack. As with a shift action, pushing a non-terminal moves the state machine to a new state, which is why we call these table entries "goto" entries; they specify which state the state machine switches to.

A shift action is looked up in the transitions of the current state. A goto action is looked up in the transitions of the state "revealed" by popping the stack during the reduce action. In both cases, the effect is to move the dot in each of the state's items one position to the right, moving over a terminal (shift) or a non-terminal (goto).

$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.