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 ( 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) SSE. 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
Get step-by-step solutions from verified subject matter experts
