Concepts of Programming Languages (11th Edition)
Concepts of Programming Languages (11th Edition)
11th Edition
ISBN: 9780133943023
Author: Robert W. Sebesta
Publisher: PEARSON
bartleby

Concept explainers

Expert Solution & Answer
Book Icon
Chapter 4, Problem 4PS

Explanation of Solution

Extended Backus-Naur Form (EBNF):

BNF is a natural notation for describing syntax described by John Backus and Peter Naur. By extending it, we had EBNF which only enhances the readability and writability of BNF.

The recursive descent parser works on the following EBNF for the arithmetic expressions:

{(+|-)}

{(*|/)}

id|int_constant|()

We know that, the following tokens are returned by the lexical analyzer for the lexemes:

TokenLexeme
11Identifier
21+ Operator
23* Operator
25(
26)

In the table the left column having the heading token refers to the token codes to the different types of the categories like:-

a) 11 = identifier

b) 21 =ADD operator

c) 23 = MULTIPLY operator

d) 25 = left brace lexeme

The example given in the problem is a(b+c). The recursive descent parser will start working from the left most term. First the whole statement is taken as an expression and it enters into expression category then the first term is taken which enters into the term category which further enters into the factor group

Blurred answer
Students have asked these similar questions
Find closed form representation for recursively defined function: T(n) = 7, when n = 1 T(n) = 5T(n/4) + n^2, when n > 1. Explore power of two. Find closed form representation in the form where T(n) = A*n^B + C*n^D. Find A, B, C, and D.   Hint: T(4) = ?, T(4^2) = ?, T(4^3) = ? to find the patten.
Give a recursive definition for the set of all strings of 0’s and 1’s that contain exactly two and consecutive 0's.
Give a recursive definition for the set of all strings of a’s and b’s where all the strings are of odd lengths. (Assume, S is set of all strings of a’s and b’s where all the strings are of odd lengths. Then S = { a, b, aaa, aba, aab, abb, baa, bba, bab, bbb, aaaaa, ...  )
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
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