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

Discussion

If a recursive descent parser encounters a construct nested a hundred thousand levels deep, the likely outcome is

  • A.a stack overflow, since recursion depth follows nesting depth
  • B.a syntax error reported at the innermost construct of them all
  • C.correct parsing, since the host stack is unbounded
  • D.an infinite loop with no output produced at all

Answer: A

Host stacks are finite, so deeply nested input can exhaust them. Table driven parsers use a heap allocated stack and are limited only by available memory. Compilers therefore often impose a documented limit on nesting depth.

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

Post your comment

Please log in or register to post a comment.