Exam-style question
Try this first
Explain why the language of balanced parentheses with arbitrary nesting can be described using BNF but cannot be represented using a regular expression. Include a suitable recursive production rule and explain its role.
Answer and explanation
Concise answer
A suitable rule is <S> ::= "(" <S> ")" <S> | empty.
Why this is correct
A strong answer identifies recursion as the important feature of BNF and connects it to unlimited nesting. It should also explain that the empty alternative terminates the recursive process and that regular expressions cannot represent this complete language.
Use the concise answer above for a quick check, then reveal the full model answer and detailed explanation.
Common mistake
No common mistake is linked to this question yet.
