Discussion
Nested comments are difficult for a conventional scanner because
Answer: B
Correct answer: counting the nesting depth is beyond the power of a finite automaton
A finite automaton has a fixed number of states and so cannot count to an arbitrary depth; matching nested comment delimiters is the same problem as matching nested brackets, which is not regular. Scanners therefore either forbid nesting, or handle it with an explicit counter written into the action code rather than in the pattern.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development