edited by
393 views
2 votes
2 votes

Which of the following sentences regarding Viable prefixes is/are CORRECT? (Mark all the appropriate choices)

  1. Viable prefixes are used in predictive parsing.
  2. Viable prefixes are the set of prefixes of right-sentential forms that do not extend past the end of the right-most handle.
  3. Set of all viable prefixes for a sentence forms a regular language.
  4. Viable prefixes have prefix-free property (no string is a prefix of any other string).
edited by

1 Answer

Best answer
3 votes
3 votes
Option A is false. Viable prefixes are used in shift-reduce parsing and not in predictive parsing.

Viable prefixes are the set of prefixes of right-sentential forms that can appear on the stack of a shift-reduce parser - as soon as the handle comes on top of stack, it gets reduced. So, options B is true.

The set of all viable prefixes of the right sentential forms of a grammar is a REGULAR LANGUAGE.

Viable prefixes are prefixes of the right sentential forms of a grammar and they do contain strings which are prefix of the other strings. That is viable prefixes do not obey the prefix-free property. Option D is false.

Correct Answer: B;C.

Reference : https://gatecse.in/viable-prefixes-and-handle-in-lr-parsing
selected by
Answer:

Related questions

1 votes
1 votes
1 answer
3