Question
I need help on this question. A sequence of parentheses is balanced if it has equal number of ( and ) symbols and in every
I need help on this question.
A sequence of parentheses is balanced if it has 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
)( is not balanced. The empty sequence is to be balanced.
Consider the grammar S --> (S) | SS | epsilon.
This grammar is claimed to generate balanced parentheses.
1. Prove that any string generated by this grammar is a properly balanced sequence of parentheses.
2. Prove that every sequence of balanced parentheses can be generated by this grammar.
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