[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Bison -v Stack Interpretation
From: |
Steve Litt |
Subject: |
Re: Bison -v Stack Interpretation |
Date: |
Thu, 21 Dec 2023 00:50:32 -0500 |
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