Concepts of Programming Languages (11th Edition)
11th Edition
ISBN: 9780133943023
Author: Robert W. Sebesta
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 4, Problem 15RQ
Explanation of Solution
Top-down Parser:
A grammar which has the following characteristics cannot be used as the basis for a top-down parser:
1) A grammar with direct or indirect left recursion.
2) A grammar which fails in pairwise disjointness test.
1) A grammar with direct or indirect left recursion:
- Example for grammar with direct left recursion: AA+B, where in a rule for a particular non terminal, the non-terminal on the LHS comes on the leftmost symbol on its RHS too.
- Example for grammar with indirect left recursion: - ABaA, AAb, where in a rule for a particular non terminal, the non-terminal comes as the leftmost symbol on its RHS can be expanded to get a string which in turn can be expanded (using rule for the left most symbol) to get that particular non terminal itself on the left most part.
In a grammar with left recursion, the first non-terminal when expanded from RHS we get the same non terminal of LHS in the grammar rule directly or indirectly. In a top down parsing since the next sentential form is obtained by expanding the left most non terminal, presence of left recursion results in indefinite recursive calls...
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
It's crucial to have a solid theoretical foundation that aids in understanding grammar vision for the following reasons: What purpose does this serve?
What is the mathematical machine on which both -top--down and -bottom--up parsers are based?
Talk about where a grammar mistake could happen during the process of processing.
Chapter 4 Solutions
Concepts of Programming Languages (11th Edition)
Ch. 4 - Prob. 1RQCh. 4 - Prob. 2RQCh. 4 - Prob. 3RQCh. 4 - Prob. 4RQCh. 4 - Prob. 5RQCh. 4 - Prob. 6RQCh. 4 - Prob. 7RQCh. 4 - Prob. 8RQCh. 4 - Prob. 9RQCh. 4 - Prob. 10RQ
Ch. 4 - Prob. 11RQCh. 4 - Prob. 12RQCh. 4 - Prob. 13RQCh. 4 - Prob. 14RQCh. 4 - Prob. 15RQCh. 4 - Prob. 16RQCh. 4 - Prob. 17RQCh. 4 - Prob. 18RQCh. 4 - Prob. 19RQCh. 4 - Prob. 20RQCh. 4 - Prob. 21RQCh. 4 - Prob. 22RQCh. 4 - Prob. 23RQCh. 4 - What was Knuths insight in developing the LR...Ch. 4 - Prob. 25RQCh. 4 - Prob. 26RQCh. 4 - Is left recursion a problem for LR parsers?Ch. 4 - Prob. 1PSCh. 4 - Prob. 2PSCh. 4 - Prob. 3PSCh. 4 - Prob. 4PSCh. 4 - Prob. 7PSCh. 4 - Prob. 8PS
Knowledge Booster
Similar questions
- In the first place, could you perhaps explain why compilers make use of approaches for parsing that are only successful with a portion of the available grammars?arrow_forwardDescribe the parsing problem for a bottom-up parser.arrow_forwardBuild a context-free grammar. Use the graphic notation to build the grammar that recognizes the IF-THEN-ELSE, in java language and python.arrow_forward
- Why do compilers utilize techniques to grammar parsing that are only successful with a subset of the available grammars?arrow_forwardWhy do compilers utilize parsing approaches that are only effective with a subset of all grammars rather than with all of them?arrow_forwardGive context free grammar for the following :arrow_forward
- Build a context-free grammar. Use the usual notation to build the grammar that recognizes the FOR loop in the java and python languages. Please Explain step by step the context-free grammar solution for each language.arrow_forwardDiscuss about the different types of parsers ad different terms involved in the grammar symbols.arrow_forwardChomsky Normal Form: Most useful grammars can be translated into a nor-mal form making answers to questions about the language more transparent.arrow_forward
- I need help developing a parser that can take a sentence generated by the context-free grammar and parse it into a parse tree, which can be used to represent the structure of the sentence. Like the example givenarrow_forwardI need help Implementing a parser for the context-free grammar using Java Develop a parser that can take a sentence generated by the context-free grammar and parse it into a parse tree, which can be used to represent the structure of the sentence. In Java. Please follow the examplearrow_forwardOutline the steps performed by the driver of a bottom-up parser.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education