Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

P PLIL M IC N print Er M print \"W\" W TWIE C if E {P if E {P) else tP) (note: t

ID: 3839694 • Letter: P

Question

P PLIL M IC N print Er M print "W" W TWIE C if E {P if E {P) else tP) (note: this has a variable o) E CEOE) IV V 0 112 I 3 (note: this has a terminal 0 (zero)) T a I b I c Id 1 Define G [10%] Show the set of variables of G Show the set of terminals of G What is the start variable of G? 2 Proving G is not LL(1) [10%] Prove that G is not an LL(1) grammar. 3 Transforming G [15%] Find an equivalent grammar G which is LL(1), by using the grammar transformation techniques shown in lectures, or otherwise. Describe the process and show your working. 4 LL(1) parse table [15%] Complete the LL(1) parse table for G. Describe the process and show your working, including: 1. FIRST sets for all the production rules of G 2. FOLLOW sets for variables of G only if they are needed

Explanation / Answer

import java.util.Scanner; public class ScannerAndKeyboard { public static void main(String[] args) { Scanner s = new Scanner(System.in); System.out.print( "Enter your name: " ); String name = s.nextLine(); System.out.println( "Hello " + name + "!" ); } }