Pearson eText for Concepts of Programming Languages -- Instant Access (Pearson+)
12th Edition
ISBN: 9780135102268
Author: Robert Sebesta
Publisher: PEARSON+
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 3, Problem 12PS
a) Consider the string “abcd”:
Explanation of Solution
b) Consider the string “acccbd”:
Explanation of Solution
The language will not accept the string “S -> acccbd” because ther...
c) Consider the string ““acccbcc”:
Explanation of Solution
The language will not accept the string “S -> acccbcc” bec...
d) Consider the string ““acd”:
Explanation of Solution
The language will not accept the string “S -> acd” because...
e) Consider the string “accc”:
Explanation of Solution
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What is the equivalent regular grammar for the following context free grammar?.
S→AB; A→aa; B→ aB | bB | A;
O A. SaS | bs | A; A→ aB;
OB.
O C.
O D. SaA; A→ aA | bA | a;
B-a
S-aA; A→ aB; B→ aB | bB | A;
S-as | bs | aA; A→ aB; B→ aB | bB | λ;
What is the equivalent regular grammar for the following context free grammar?.
S→AB; A→aa; B→ aB | bB | λ;
A. S→ aS | bS | A; A→ aB; B→a
B. S→aA; A→ aB; B→ aB | bB | λ;
C. S→aS | bS | aA; A→ aB; B→ aB | bB | λ;
D. S→ aA; A→ aA | bA | a;
Show that the following grammar is ambiguous:
X -> a | bx | bXcX
where a,b,c are terminals.
The grammar is ambiguous because ...
Chapter 3 Solutions
Pearson eText for Concepts of Programming Languages -- Instant Access (Pearson+)
Ch. 3 - Prob. 1RQCh. 3 - Prob. 2RQCh. 3 - Prob. 3RQCh. 3 - Prob. 4RQCh. 3 - Prob. 5RQCh. 3 - Prob. 6RQCh. 3 - Prob. 7RQCh. 3 - Prob. 8RQCh. 3 - Prob. 9RQCh. 3 - What is the difference between a synthesized and...
Ch. 3 - Prob. 11RQCh. 3 - Prob. 12RQCh. 3 - Prob. 13RQCh. 3 - Prob. 14RQCh. 3 - Prob. 15RQCh. 3 - Prob. 16RQCh. 3 - Prob. 17RQCh. 3 - Prob. 18RQCh. 3 - Prob. 19RQCh. 3 - Prob. 20RQCh. 3 - Prob. 21RQCh. 3 - What does partial correctness mean for a loop...Ch. 3 - Prob. 23RQCh. 3 - Prob. 24RQCh. 3 - Prob. 25RQCh. 3 - Prob. 26RQCh. 3 - Prob. 27RQCh. 3 - Prob. 28RQCh. 3 - Prob. 29RQCh. 3 - The two mathematical models for language...Ch. 3 - Write EBNF descriptions for the following: a. A...Ch. 3 - Prob. 3PSCh. 3 - Prob. 4PSCh. 3 - Prob. 5PSCh. 3 - Prob. 6PSCh. 3 - Prob. 9PSCh. 3 - Prob. 10PSCh. 3 - Prob. 12PSCh. 3 - Prob. 15PSCh. 3 - Prob. 16PSCh. 3 - Prob. 17PSCh. 3 - Prob. 18PSCh. 3 - Compute the weakest precondition for each of the...
Knowledge Booster
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
- QUESTION 2: Consider the following grammar (the start symbol is X; the alphabets are implicit in the rules): to answer the following: X- BX| € В — В1| оВ1 | 01 A. Give a right-most derivation for the terminal string: 010101. B. Give a left-most derivation for the terminal string: 010101. C. Show that the grammar is ambiguous by exhibiting two distinct derivation trees for some terminal string example 00111.arrow_forwardWhat is the equivalent regular grammar for the following context free grammar?. O A. SaS | bS | A; AaB; B-a O B. SaaS | bSaA; AaB; BaB | bB | λ; O C. S-aA; AaB; BaB | bB | λ; O D. SaA; AaA | bA |a; SAB; AaA | bA | λ; Baa;arrow_forwardThis question is based on the following grammar: exp -> exp + term I term term> term factor I factor factor -> num var | ( exp) i. Explain why this grammar is not suitable for recursive descent parsing. Modify the grammar so that it is in a suitable form. ii. Show both the parse tree and the abstract syntax tree for: 3 + x + y*y * zarrow_forward
- Write a BNF grammar for simple phone numbers e.g. (9)123-4567 (21)987-1234 The number must start with a left parenthesis, followed by 1or 2 digits, followed by a right parenthesis, followed by 3 digits, followed by a hyphen, followed by 4 digits. All digits, including 0, can be used anywhere a digit is required. There must be at least 3 rules in your grammar. The goal non-terminal should be called .arrow_forwardWrite a BNF grammar for simple phone numbers e.g. (9)123-4567 (21)987-1234 The number must start with a left parenthesis, followed by 1or 2 digits, followed by a right parenthesis, followed by 3 digits, followed by a hyphen, followed by 4 digits. All digits, including 0, can be used anywhere a digit is required. There must be at least 3 rules in your grammar. The goal non-terminal should be called <phone>.arrow_forwardQUESTION 4: CONSIDER THE FOLLOWING GRAMMAR THEN ANSWER THE QUESTIONS BELOW: S -a | bbA | B A → aB_ 2 B → ad | dD C- cC c www D - Dd A. Remove all null productions: B. Remove all unit productions C. Remove all useless productionsarrow_forward
- Please provide an explanation for each option to demonstrate that your answer is right.arrow_forwardQUESTION 10 Consider the following grammar: 1. S a a 2. SA B b S SBS 5. B A A C 6. B b c A 3. A 4. A . ↑ ↑ ↑ →→>> Show the Tokens and Productions sections of sablecc grammar file corresponding to this grammar.arrow_forward1. Use the algorithm described in class that takes a CFG and converts it into a CNF (Chomsky Normal Form) grammar that generates the same language as the original grammar, except possibly for the string A, to answer the following question. As part of your answer, you should say which variables are nullable, and you should give the appropriate grammar after each step of the algorithm. There are four steps. Give a CFG (context-free grammar) in CNF (Chomsky Normal Form) that generates the same language, except possibly for the string A, as the following grammar: SAB AB →bAa A → aaB bbarrow_forward
- Detailed answer please. Thank youarrow_forwardQUESTION Consider G be a Context Free Grammar for which the production Rules are given below:S -> aB|bAA -> a|aS|bAAB -> b|bS|aBBDrive the string Arababad using the above grammar by using Right Most Derivation.arrow_forward1 CFGS Consider the following grammar. erpr := erpr + expr | erpr + erpr|(crpr) | number number := number digit | digit digit := 0 I 1 | 21 3I 4I5I 6I7 | 8 I 9 1. Redefine the grammar in a way that numbers are defined by regular expressions. That is, remove two grammar rules for number and digit nonterminals, and replace them with a single regular expres- sions for numbers. 2. Modify the grammar to define assignment statements with a syntax similar to C/C+, where ex- pressions are assigned to identifiers. Here are the steps: (a) Add identifier token ID to the CFG. You may define it with regular expressions (since identi- fiers are tokens). We have already seen how to define identifiers with regular expressions, in previous sessions. (b) Consider a nonterminal for assignment. Let's call this nonterminal assignment. You need to define a CFG rule that defines assignment. An assignment in C/C+ grammatically consists of an identifier (defined in previous step), folowed by equality symbol (a…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