Suppose I have a language consisting of just balanced parentheses, i.e., {ε, ( ), ( ( ) ), ( ) ( ), ( ( ( ) ) ), ( ( ) ( ) ), … } and I’m asked to write a recursive definition for it. Could somebody give me an example of what that could look like? – I’m a bit new to this type of computer science theory.
Suppose I have a language consisting of just balanced parentheses, i.e., {ε, ( ),
Share
A kind of recursive definition is grammar. To generate language of balanced parentheses :
this is recursive because
Sappears inRHSof production rules.production rules:
LHS --> RHSEDIT
Why
(s)notS?because to add
()pairs recursively and more then one time.in second step inner
Sis replaced by(S).