Q.1 SORRY, THIS QUESTION TURNS OUT TO BE UNSOLVABLE, I suspect! HERE ARE MY NOTES ON WHAT ONE CAN TRY AND HOW I GRADED. A ::= B A x | x B ::= A y A | x can be transformed to (by inlining B): A ::= A y A A x | x A x | x can be transformed to (by eliminating left recursion): A ::= C B B ::= epsilon | y A A x B C ::= x A x | x can be transformed to (left factoring): A ::= C B B ::= epsilon | y A A x B C ::= x D D ::= A x | epsilon can be transformed to (by inlining C): Nullable First Follow A ::= x D B No x x B ::= epsilon | y A A x B Yes y x D ::= A x | epsilon Yes x x y Notice that First(B) and Follow(B) have an empty intersection but that First(D) and Follow(D) have an nonempty intersection. So the grammar is not LL(1). Does this question have a solution? At the time of writing this file, I don't know. However, people who got most of the above, or made a similar amount of progress, got maximum points. People who made some progress typically got a generous number of points. Q.2 Nullable First Follow A ::= x B | C y No x y z z B ::= A z C No x y z y z C ::= z B | epsilon Yes z y z C is nullable, and First(C) and Follow(C) has a nonempty overlap, so the grammar is NOT LL(1). Q.3 A ::= x B C B ::= x | y C ::= y B C | epsilon void eat(Token t) { if (token == t) token = nextToken(); else error(); } A(): token = nextToken(); eat("x"); B(); C(); eat(EOF); B(): if (token == "x" || token == "y") token = nextToken(); else error(); C(): if (token == "y") { token = nextToken(); B(); C(); }