17.2 ITEMS AND CLOSURE

Before we look at LR parsing in more depth, we give two definitions. First, we want to know when a right-hand side of a production is on top of the stack. Each symbol from the right-hand side is put on the stack one at a time. To keep track of which symbols from the right-hand side are on top of the stack and which ones are not, we add a marker to the right-hand side, placing the marker between the symbols that are on top of the stack and the symbols that are not yet on the stack. Our first definition is for this marked production, called an item.

Get An Introduction to Formal Languages and Automata, 7th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.