answersLogoWhite

0


Best Answer

Stacks are not only the preferred data structure for bottom up parsing, they are the only data structure suitable for bottom up parsing.

Bottom-up parsing is usually referred to as depth-first search. Top-down parsing is referred to as breadth-first search. The two are exactly the same in terms of implementation, the difference is only in the structure used to store information collated from the previous iterations. With top-down parsing you use a queue, pushing to the back and popping from the front. With bottom-up parsing you use a stack, pushing to and popping from the back.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why stack is preferable data structure for bottom up parsing?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does it mean that the stack is a LIFO structure?

LIFO stands for Last In First Out. It basically means that the most recent piece of data added to a list, will be the first piece that is taken off. It is often compared to a stack of plates. When you have a plate to add to the the stack, you put it on the top, not in the middle or at the bottom of the stack. If you need a plate you usually take it from the top, not the middle or bottom. So the most recent plate on the top is the first that will be taken off when one is needed.


Explain The merits of using a deque to implement a stack in data structure?

Explain The merits of using a deque to implement a stack in data structure


What is the resource requirement of stack in a data structure?

no answer


Can stack be called fifo data structure?

No. A stack is a LIFO (Last In First Out) data structure.A queue is a FIFO (First In First Out) data structure.


What is a stack in data structure?

A stack is a linear data structure that follows the Last In, First Out (LIFO) principle, where elements are added and removed from the same end called the top. Elements can only be added or removed from the top of the stack, making it a simple and efficient data structure for storing and accessing data.


To what does the term grana refer?

A stack of thylakoids inside the cholorplast of a plant cell. A stack of thylakoid membrane structure


What layer is always at the bottom of the stack in Photoshop?

Background.


Why is the queue data structure called a LIFO?

It isn't! A queue is a FIFO structure, not a LIFO structure. FIFO is an acronym for First-In, First-Out and is analogous with first come, first served (as per a queue of people waiting to be served). LIFO is an acronym for Last-In, First-Out, which is analogous with a stack structure, where the last element added is always placed on top of the stack while the top-most element of the stack is always the first to be removed from the stack.


How is the old stack pointer value recovered on a function return?

If your stack grows bottom-up, it's decremented when you leave a function; if the stack grows top-down, the stack pointer is incremented.


How do you reduce in parsing table for expression grammar in compiler course. i under stand the shift action but unable to understand reduce action please help?

In a parsing table for an expression grammar, the reduce action is used to combine grammar rules to reduce a portion of the input string into a non-terminal symbol. When the parser encounters a reduce action in the parsing table, it replaces a set of symbols on the top of the stack with the non-terminal symbol that corresponds to the grammar rule being applied. This helps in simplifying the input string and moving towards the final goal of parsing the entire input.


What is the difference between a queue and a stack with example?

A stack is a data structure in which last item inserted is taken out first . That's why they are known as LIFO (last in first out). Inserting an item in stack is termed as push and taking an item out from stack I s termed as pop. Stack pointer is the pointer that points to the top of the stack or that points the item at the top of the stack and help in adding or deleting the item from the top of stack. The queue is a linear data structure where operations of insertion and deletion are performed at separate ends also known as front and rear. Queue is a FIFO structure that is first in first out. types of queues : circular, linear, double ended and priority


Which type of data structure is used in ATM to take the printout of last 5 transactions?

stack data structure.