push and pop operations
A stack supports just two basic moves, and they are exactly the moves you make with a pile of plates. PUSH adds a new symbol to the top of the stack, raising the pile by one. POP removes the symbol currently on top, lowering the pile by one and revealing whatever was beneath it. That is the entire vocabulary of a stack — there is no 'reach into the middle', no 'read the third item down'. Everything a pushdown automaton does to its memory is built from these two.
In a PDA the two are usually bundled into a single atomic move. The standard convention is: every transition first POPS the current top symbol, then PUSHES a string of zero or more symbols in its place. This one rule unifies all the cases. Pushing the empty string (popping and replacing with nothing) is a pure pop, shrinking the stack. Pushing back exactly the symbol you popped, plus one more, is a net push, growing the stack. Pushing back exactly the same single symbol leaves the height unchanged but lets the machine change state — a peek-and-stay. So 'pop one, push a string' is a single flexible operation that covers grow, shrink, and stay.
These two operations are why a stack models nesting so naturally. Opening a bracket pushes a reminder; closing one pops it; and because pop always takes the most recent push, the most recently opened bracket is the first to be matched and removed — exactly the discipline real nested syntax obeys. The same push/pop pair is what your CPU does on every function call (push a return address and locals) and return (pop them), which is why the runtime structure is literally called the call stack.
Replace-the-top: a transition that pops X and pushes XX grows the stack by one X; popping X and pushing nothing (ε) shrinks it; popping X and pushing X leaves the height the same. All three are written as 'pop one, push a string'.
Push grows, pop shrinks; the unified PDA move is 'pop the top, then push a (possibly empty) string'.
A PDA cannot read or change anything below the top. If you ever need to inspect a buried symbol, you must pop everything above it first — and those popped symbols are gone unless you pushed them back.