Concepts Of Programming Languages
Concepts Of Programming Languages
12th Edition
ISBN: 9780134997186
Author: Sebesta, Robert W.
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
Explain why compilers, in the first place, use parsing techniques that are only effective on a subset of all grammars.
Discuss about the different types of parsers ad different terms involved in the grammar symbols.
From the grammar for an ILOC program, can we parse this grammar using a predictive top-down parser? State your reason briefly.
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