A predictive parser uses this grammar, with start symbol SSS and an external end-of-input marker called EOF:
Complete the decision table for a call to RRR. Enter exactly continue for R→+idRR \to +\mathrm{id}RR→+idR, empty for R→εR \to \varepsilonR→ε, or error when neither production is valid for the lookahead token.
Unlock full course notes by signing up
Two Structures for One Token Sequence
An expression grammar has start symbol EEE and productions
For the token sequence id(a) + id(b) * id(c), which statements are true? Select every true statement. No precedence or associativity rules supplement the grammar.
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}S→name=value
Counting Ambiguous Groupings
An expression parser uses the ambiguous grammar
Inputs contain identifiers separated by plus tokens, with no parentheses. Let NnN_nNn be the number of structurally distinct parse trees for a fixed sequence containing nnn identifiers. Do not count different expansion orders for the same tree separately.
Recursion Direction and Parser Stack Space
A configuration tool parses the list alpha, beta, gamma, delta, eta, theta, kappa, omega. Each identifier becomes one id token, and each comma becomes one comma token. Compare two bottom-up parsers that start with empty stacks.
The left-recursive grammar is: