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

Discussion

An LR parser given a syntactically valid but semantically meaningless program will

  • A.fail to terminate
  • B.generate the target code for it without any complaint at all
  • C.parse it successfully and leave the objection to a later phase
  • D.report a syntax error at the meaningless construct

Answer: C

Nothing in the grammar constrains what may be combined with what. An expression joining a string to the name of a function reduces without any complaint at all, and only the type checker holds the information needed to object to it. Form and meaning are separate questions, settled by separate phases of the compiler.

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

Post your comment

Please log in or register to post a comment.