Concepts Of Programming Languages
12th Edition
ISBN: 9780134997186
Author: Sebesta, Robert W.
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
The following shows a simple context free grammar (CFG) :
Which of the following sentences are recognized by this grammar: 5+9+5, 2+8*(4*9)*4*(7+6), 3+7-2
Exercise 1
Consider the following BNF grammar for a language. Answer the questions below according to the grammar.
<fun> -> <pon>
<fun> -> <pon> + <fun>
<ybu> -> <fun>
<ybu> -> <fun> @ <ybu>
<pon> -> A
<pon> -> Y
<pon> -> B
<pon> -> U
A. What is the associativity of the @ operator: left-right-neither
B. What is the associativity of the + operator: left-right-neither
C. Which operator has higher precedence: @-+-neither
D. The grammar is left recursive-right recursive-both-neither
(20 Points) Consider the following grammars where S is the start symbol and a, b, and c are terminal symbols and A, B, and C are non-terminal symbols.S ---> aA | bB | cCA --> aA | aB | aB --> bB | bC | bC --> cC | cExplain in your own words what the grammar generates. Which of the following sentences are in the language generated by the grammar? Show derivations. If a sentence cannot be generated by the grammar, explain why
abcabcab
aaaaaabb
cccccaaaa
bbbbbbbc
aaaaaaccc
Chapter 3 Solutions
Concepts Of Programming Languages
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
- Given the following language: {cidj | i>2j, i,j≥0} What is the context free grammar?arrow_forwardConsider the following context free grammar in BNF form for simple English sentences: (r1) <sentence> → <article> <noun> <verb> <adverb> (r2) <article> → a (r3) <article> → an (r4) <article> → the (r5) <noun> → apple (r6) <noun> → rose (r7) <noun> → umbrella (r8) <verb> → is (r9) <verb> → appears (r10) <adverb> → here (r11) <adverb> → there Give the derivation of the sentence “the apple is there” by using one or more of the above rules.arrow_forwardFor grammar, G2 compute the following: Director(E,TE’), Director(E’,+TE’), Director(E’, ε), Director(T,FT’), Director(T’,*FT’), Director(T’,ε), Director(F,(E)), Director(F,i) The grammar G2 is attached below: E ENTE, E +TELE , ++ TFT, T*FT|E ** F– (E) | >arrow_forward
- Consider the following grammar:<A> -> <B>c | <C>b<B> -> a | <B>a<C> -> b | a<C>What nonterminals are disjoint? Explain.arrow_forwardQuestion 2-Context-free Grammars Consider the alphabet = {A, V., (,), x, y, z) and the following grammar G = (V,E, R, F), defined by the rules: F (FAF) | (FVF) | (F) | P (a) Identify the set of variables and the set of terminal symbols of G. (b) Identify three words (of lengths between 10 and 20) that can be generated by the above grammar and show their derivations. (c) Consider a modified grammar G', where we remove the brackets '(' and ')' from the alphabet and the derivation rules. That is we set Σ'= {A, V., x, y, z) and we remove all occurrences of brackets in the derivation rules. Show that there are words that are derived ambiguously in G'arrow_forwardrefer to the grammar S -> aSa | aXa X ->aXa | bYb Y -> bYb | empty where S is the start symbol, non-terminals = {S, X, Y}, terminals = {a, b} This Question: Use the pumping lemma to show that the language generated by this grammar is not regular.arrow_forward
- Consider the following grammar then answer the questions below: S -> statements S -> repeat statements while condition S -> repeat statements until condition Is the above grammar LL (1) grammar? If not, mention why? And convert it into LL(1).arrow_forwardConsider the grammar G below in the input alphabet {num, *, /, -}, with non-terminal leading S' in rule 1. S'→S$ S→E - F F→E * E E→num E→num / num a) Build the G grammar automaton. Is this grammar LR(0)? b) If G is not LR(0), list the items present in the DFA state where the conflict occurs. c) Is this grammar SLR? d) If G is SLR, write the non-terminal follow that resolves the LR(0) conflict. (Separate the items in the set with “:”. Ex: a:b )arrow_forwardWhat 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;arrow_forward
- Question 13) Consider the following context-free grammar G over the alphabet Σ = {a, b, c}, where S is thestart variable:S → aSb | ε | acSbaUsing the rules of the grammar G, give a derivation for the word acabba.arrow_forwardwrite a grammar equivalent to the following AFarrow_forwardComputer Science Consider the following two grammars with alphabet a and b i. (b*ab*a)*b* ii. (b*ab*a)*b*(b*ab*a)*b* Are there any strings are generated by one of the grammars and cannot be generated by the other? If there are more than one such string, how do you describe them.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