Question: Problem 2 7 . Consider the following algorithm which takes a grammar G = ( V , , P , S ) as input and
Problem Consider the following algorithm which takes a grammar as input and returns True or False. As usual, is the set of nonterminals, is the alphabet, is the set production rules, and SinV is the initial nonterminal.
Tlarr
while contains a production rule of the form where inT and do TlarrT
end while
If SinT then return True, else return False.
What interesting property of is this algorithm testing? Prove your answer.
Homework Problem Make minimal changes to the above algorithm so that your modified algorithm returns True if and only if Prove that your algorithm is correct.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
