Pearson eText for Concepts of Programming Languages -- Instant Access (Pearson+)
Pearson eText for Concepts of Programming Languages -- Instant Access (Pearson+)
12th Edition
ISBN: 9780135102268
Author: Robert Sebesta
Publisher: PEARSON+
Expert Solution & Answer
Book Icon
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...

Blurred answer
Students have asked these similar questions
What is the mathematical machine on which both -top--down and -bottom--up parsers are based?
True or False, please have some explanation 3. Grammar with the right recursion can not be converted to grammar for the same language that has only left recursion.
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?
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education