Question: BASED ON DISCRETE MATHS AND COMPUTER SCIENCE = PROBLEM 3 (5 marks) The grammar GBP = ({C,)},{S}, {S + () | SS| (s)},5) generates the

BASED ON DISCRETE MATHS AND COMPUTER SCIENCE

BASED ON DISCRETE MATHS AND COMPUTER SCIENCE = PROBLEM 3 (5 marks)

= PROBLEM 3 (5 marks) The grammar GBP = ({C,)},{S}, {S + () | SS| (s)},5) generates the language of nonempty balanced parentheses strings, that is, strings like () and (0)(), but not 1, ) and ((). 1. Use the rules of GBp to generate the string () () (). Show clearly all the steps of the generation. 2. Using the grammar GBP as a guide, write a new grammar to generate the language of two types of nonempty balanced parentheses strings such as []() and [[]()]. The alphabet in this case is {(,), [,1}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!