Unformatted text preview: 2. Consider the grammar A ::= x B  C z B ::= A x C C ::= y B  ± where { A,B,C } is the set of nonterminal symbols, A is the start symbol, { x,y,z } is the set of terminal symbols, and ± denotes the empty string. Is the grammar LL(1)? Justify your answer. As part of your answer, show the ±IRST and ±OLLOW sets for each nonterminal symbol. 3. Consider the grammar A ::= x C  z B ::= y A C ::= B x  A y B where { A,B,C } is the set of nonterminal symbols, A is the start symbol, and { x,y,z } is the set of terminal symbols. The grammar is LL(1). Sketch Java code in reasonable detail for a recursivedescent parser based on the grammar. 1...
View
Full Document
 Winter '08
 CHU
 Formal grammar, Contextfree grammar, Topdown parsing, Parsing expression grammar, start symbol

Click to edit the document details