help-bison
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bison -v Stack Interpretation


From: Piotr Siupa
Subject: Re: Bison -v Stack Interpretation
Date: Thu, 21 Dec 2023 08:36:03 +0100

The manual has a nice explanation of those concepts:
https://www.gnu.org/software/bison/manual/html_node/Algorithm.html

Regards,
Piotr


On Thu, Dec 21, 2023 at 6:51 AM Steve Litt <slitt@troubleshooters.com>
wrote:

> James K. Lowden said on Tue, 19 Dec 2023 21:11:41 -0500
>
> >On any given token, the parser either shifts the token onto its stack,
> >or reduces the stack.  To me, all the interesting stuff happens when
> >reducing, because that's literally where the action is.
>
> I'm puzzled about the words "stack", "shift", and "reduce".
>
> As has always been explained to me, the meaning of the word "stack" is
> that it's a Last In First Out (LIFO) array, object, contraption,
> whatever, and that when you add something it's called "pushing" it onto
> the stack, and when you remove something, the something removed is the
> one that last got pushed, and that's called "popping" it from the stack.
> What exactly is meant by "shift" and "reduce"?
>
> Thanks,
>
> SteveT
>
> Steve Litt
>
> Autumn 2023 featured book: Rapid Learning for the 21st Century
> http://www.troubleshooters.com/rl21
>
>


reply via email to

[Prev in Thread] Current Thread [Next in Thread]