Machine-translated by Google. Questions are authored in English.
Top

Discussion

State whether the following is true or false.
The set of strings consisting of n opening brackets followed by n closing brackets is a regular language.

  • A.False only at small scales
  • B.True
  • C.False
  • D.True only at large scales

Answer: C

Correct answer: False

This is the standard non-regular language. A finite automaton would have to remember how many opening brackets it had seen in order to require the same number of closing ones, and with finitely many states it cannot count without bound. The pumping lemma makes the argument precise, and the same reasoning is why nested comments defeat a pure scanner.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.