Exam-style question
Try this first
Why can BNF represent some languages that cannot be represented using regular expressions?.
- A.BNF can use recursive production rules, allowing structures such as arbitrarily nested pairs
- B.BNF always uses fewer symbols than a regular expression
- C.BNF automatically checks whether every character is typed correctly
- D.BNF can represent only languages with a fixed maximum length
Model answer
What a good answer should say
- BNF can use recursive production rules, allowing structures such as arbitrarily nested pairs
Explanation
Why this works
A recursive BNF rule can refer to itself and so describe structures with unlimited nesting, such as balanced parentheses. Regular expressions cannot represent every such language.
Common mistake
No common mistake is linked to this question yet.
