Answered step by step
Verified Expert Solution
Question
1 Approved Answer
A grammar G = (T,N,S,P) has T = {x,y,z}, N = {Z,A,B}, S = Z, and the following productions P: Z A A x y
A grammar G = (T,N,S,P) has T = {x,y,z}, N = {Z,A,B}, S = Z, and the following productions P:
|
Show that the above grammar is ambiguous.
Use the sentence x y z.
Part B (5 marks):
A program has been written that can simulate coin tosses until it generates two heads in a row. Write a grammar for a language whose sentences are the output from this program.
For example, valid sentences include hh, thtttttthh, hthh, thththttthh, and invalid sentences include h, thhhh, hhttthh, hthhtt, hhhtthhh.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started