Context-Free Languages Grammar • S -> xyXxX | xyXyy | yy • X -> xx (a) What is an ambiguous grammar? Give an example of a grammar that is inherently ambiguous. (b) Show that the grammar given below is ambiguous by drawing two different derivative trees for the same string. (c) Express the grammar in the Chomsky Normal Form and Greibach Normal Form. (d) Construct a Pushdown Automaton that accepts the languages created by this grammar.
Added by Stephen B.
Step 1
This ambiguity can lead to confusion in parsing the string since it's unclear which derivation to follow. Example of an inherently ambiguous grammar: - S -> 0S0 | 1S1 | ε This grammar generates palindromes over {0, 1}. The string "010" can be derived in two Show more…
Show all steps
Your feedback will help us improve your experience
John Incabo and 69 other AP CS educators are ready to help you.
Ask a new question
Labs
Want to see this concept in action?
Explore this concept interactively to see how it behaves as you change inputs.
Key Concepts
Recommended Videos
Madhur L.
Determine whether the given grammar is contextsensitive, context-free, regular, or none of these. Give all characterizations that apply. $$ < S > : : = b < S > | a < A > | a $$ $$ < A > : : = a< S >\mid b < B > $$ $$ < B >: := b < A >| a< S > | b $$ with starting symbol $<S>$.
Automata, Grammars, and Languages
Languages and Grammars
In each case below, say what language (a subset of {a, b}*) is generated by the context-free grammar with the indicated productions. e. S -> TT T -> aT | Ta | b f. S -> aSa | bSb | aAb | bAa A -> aAa | bAb | a | b | Α g. S -> aT | bT | Α T -> aS | bS h. S -> aT | bT T -> aS | bS | Α
Akash M.
Recommended Textbooks
Computer Science and Information Technology
Introduction to Programming Using Python
Computer Science - An Overview
18,000,000+
Students on Numerade
Trusted by students at 8,000+ universities
Watch the video solution with this free unlock.
EMAIL
PASSWORD