Question: Question 1|25 points] A sequence of parentheses is a sequence of ( and ) symbols or the empty sequence. Such a sequence is said to

 Question 1|25 points] A sequence of parentheses is a sequence of

Question 1|25 points] A sequence of parentheses is a sequence of ( and ) symbols or the empty sequence. Such a sequence is said to be balanced if it has an equal number of ( and ) symbols and in every prefix of the sequence the number of left parentheses is greater than or equal to the number of right parentheses. Thus ((()) ()) is balanced but, for example, ()) ( is not balanced even though there are an equal number of left and right parentheses. The empty sequence is considered to be balanced. Consider the grammar S + (S)|SS|E. This grammar is claimed to generate balanced parentheses. 1. Prove that any string generated by this grammar is a properly balanced sequence of parentheses. [10] 2. Prove that every sequence of balanced parentheses can be generated by this grammar. [15]

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!