Delaying a Predictive Choice

A command parser chooses a production using only the next input token. The token names name and value each denote a single token category. The symbols =, (, and ) are literal tokens.


The original grammar has these labelled productions:

  • O1: S→name  =  valueS \to \text{name}\;=\;\text{value}
  • O2: S→name  (  value  )S \to \text{name}\;(\;\text{value}\;)

A transformed grammar has these labelled productions:

  • F1: S→name  TS \to \text{name}\;T
  • F2: T→=  valueT \to =\;\text{value}
  • F3: T→(  value  )T \to (\;\text{value}\;)

Complete each predictive parsing entry. Enter the production label when exactly one production can begin with the next token, conflict when more than one can, or error when none can. Treat each row as a separate lookup for the indicated nonterminal.

GrammarNonterminalNext tokenEntry
OriginalSname
OriginalSvalue
TransformedSname
TransformedT=
TransformedT(
TransformedTvalue

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Parsing Questions: