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

Discussion

Using an ambiguous expression grammar together with precedence declarations, compared with a layered unambiguous grammar, gives

  • A.a smaller table and fewer single production reductions at run time
  • B.a parser that turns away expressions the language ought to admit
  • C.a table indistinguishable from the one the layered grammar gives
  • D.a parser that cannot be generated by any available tool

Answer: A

Correct answer: a smaller table and fewer single production reductions at run time

The layered grammar encodes precedence in its structure through chains such as E to T to F, and every level costs a unit reduction at parse time as well as extra states. An ambiguous grammar with precedence declarations expresses the same language with fewer productions, so the table is smaller and the parse does less work.

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

Post your comment

Please log in or register to post a comment.