What is Handle Pruning? Last Updated : 18 Jan, 2022 Comments Improve Suggest changes Like Article Like Report The handle is the substring that matches the body of a production whose reduction represents one step along with the reverse of a Rightmost derivation. The handle of the right sequential form Y is the production of Y where the string S may be found and replaced by A to produce the previous right sequential form in RMD(Right Most Derivation) of Y. Sentential form: S => a here, 'a' is called sentential form, 'a' can be a mix of terminals and nonterminals. Example: Consider Grammar : S -> aSa | bSb | ε Derivation: S => aSa => abSba => abbSbba => abbbbaLeft Sentential and Right Sentential Form: A left-sentential form is a sentential form that occurs in the leftmost derivation of some sentence.A right-sentential form is a sentential form that occurs in the rightmost derivation of some sentence.Handle contains two things:ProductionPositionExample: S -> aABe A -> Abc | b B -> dSteps: abbcde : γ = abbcde , A->b; Handle = b aAbcde : γ = RHS = aAbcde , A->Abc; Handle = Abc aAde : γ = aAde , B->d; Handle = d aABe : γ = aABe, S-> aABe; Handle = aABeNote- Handles are underlined in the right-sentential forms. Is the leftmost substring always handled?No, choosing the leftmost substring as the handle always, may not give correct SR(Shift-Reduce) Parsing. Handle Pruning:Removing the children of the left-hand side non-terminal from the parse tree is called Handle Pruning. A rightmost derivation in reverse can be obtained by handle pruning. Steps to Follow:Start with a string of terminals 'w' that is to be parsed.Let w = γn, where γn is the nth right sequential form of an unknown RMD.To reconstruct the RMD in reverse, locate handle βn in γn. Replace βn with LHS of some An ⇢ βn to get (n-1)th RSF γn-1. Repeat.Example 1: Right Sequential FormHandleReducing Productionid + id * ididE ⇒ idE + id * ididE ⇒ idE + E * ididE ⇒ idE + E * EE + EE ⇒ E + EE * EE * EE ⇒ E * EE (Root) Example 2: Right Sequential FormHandleProductionid + id + ididE ⇒ idE + id + ididE ⇒ idE + E + ididE ⇒ idE + E + EE + EE ⇒ E + EE + EE + EE ⇒ E + EE (Root) Comment More infoAdvertise with us Next Article What is Handle Pruning? S snowflake203 Follow Improve Article Tags : Computer Subject Compiler Design GATE CS Similar Reads What is OSI Model? - Layers of OSI Model The OSI (Open Systems Interconnection) Model is a set of rules that explains how different computer systems communicate over a network. OSI Model was developed by the International Organization for Standardization (ISO). The OSI Model consists of 7 layers and each layer has specific functions and re 13 min read Non-linear Components In electrical circuits, Non-linear Components are electronic devices that need an external power source to operate actively. Non-Linear Components are those that are changed with respect to the voltage and current. Elements that do not follow ohm's law are called Non-linear Components. Non-linear Co 11 min read Introduction of ER Model The Entity-Relationship Model (ER Model) is a conceptual model for designing a databases. This model represents the logical structure of a database, including entities, their attributes and relationships between them. Entity: An objects that is stored as data such as Student, Course or Company.Attri 10 min read DBMS Tutorial â Learn Database Management System Database Management System (DBMS) is a software used to manage data from a database. A database is a structured collection of data that is stored in an electronic device. The data can be text, video, image or any other format.A relational database stores data in the form of tables and a NoSQL databa 7 min read TCP/IP Model The TCP/IP model (Transmission Control Protocol/Internet Protocol) is a four-layer networking framework that enables reliable communication between devices over interconnected networks. It provides a standardized set of protocols for transmitting data across interconnected networks, ensuring efficie 7 min read Types of Network Topology Network topology refers to the arrangement of different elements like nodes, links, or devices in a computer network. Common types of network topology include bus, star, ring, mesh, and tree topologies, each with its advantages and disadvantages. In this article, we will discuss different types of n 12 min read Normal Forms in DBMS In the world of database management, Normal Forms are important for ensuring that data is structured logically, reducing redundancy, and maintaining data integrity. When working with databases, especially relational databases, it is critical to follow normalization techniques that help to eliminate 8 min read Operating System Tutorial An Operating System(OS) is a software that manages and handles hardware and software resources of a computing device. Responsible for managing and controlling all the activities and sharing of computer resources among different running applications.A low-level Software that includes all the basic fu 4 min read Computer Network Tutorial A Computer Network is a system where two or more devices are linked together to share data, resources and information. These networks can range from simple setups, like connecting two devices in your home, to massive global systems, like the Internet. Below are the main components of a computer netw 7 min read Spring Boot Tutorial Spring Boot is a Java framework that makes it easier to create and run Java applications. It simplifies the configuration and setup process, allowing developers to focus more on writing code for their applications. This Spring Boot Tutorial is a comprehensive guide that covers both basic and advance 10 min read Like