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

Discussion

Parsing expression grammars differ from context free grammars in that their choice operator is

  • A.ordered, so the first successful alternative is taken
  • B.unordered, so all alternatives are explored in parallel
  • C.restricted to at most two alternatives per rule
  • D.applied only to terminals and never to nonterminals

Answer: A

Correct answer: ordered, so the first successful alternative is taken

In a parsing expression grammar the choice operator is ordered: alternatives are tried in sequence and the first that succeeds is committed to. This makes every PEG unambiguous by construction, since there is exactly one parse - but it also means a rule can silently shadow a later alternative if the order is wrong.

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

Post your comment

Please log in or register to post a comment.