Contents    Page-10    Prev    Next    Page+10    Index   

The data structure needed to parse a context-free language is a:

  • A: record
  • B: 2-D array
  • C: tree
  • D: hash table
  • E: stack

    Answer: E

    In general, a stack is needed to traverse a tree. The stack records the ancestors of the current node in the tree. A context-free parsing constructs a parse tree.