EBK CONCEPTS OF PROGRAMMING LANGUAGES
EBK CONCEPTS OF PROGRAMMING LANGUAGES
12th Edition
ISBN: 9780135102251
Author: Sebesta
Publisher: VST
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
can you draw the shortest path tree using BFS for the following directed unweighted graph?
What is the shortest path from vertex 3 to all other vertices:Which graph algorithm can solve the problem most efficiently(the quickest runtime)How could the same algorithm if the graph had edge weights? (create intermediate nodes)
The difference between (1) a database management system (DBMS) and (2) a database, is:     a. The first refers to a complete accounting system, the second refers to a subset of that b. The first is program software, the second is proprietary data and related files c. The first is hardware, the second is software d. Nothing—these terms are synonyms..
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
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning