Suppose that your grades are kept in a file with the followi
     Suppose that your grades are kept in a file with the following formal:  The file contains one or more student records.  Each student record has one student\'s name, then their ID number, then zero or more grades, separated by commas.  Each grade is an integer value followed by zero or more stars (to represent the number of days late).  This being a course on compilers, the TAs decided to write a parser to read the grades, making it easy to summarize. Here\'s a CFG for the grade file formal that they came up with. The grade file is updated after every assignment is graded.  file rightarrow record tail  tail rightarrow file | t  record rightarrow NAME IDNUM optGrades  optGrades rightarrow grades | t  grades rightarrow oneGrade | oneGrade COMMA grades  oneGrade rightarrow INTLIT optLate  optLete rightarrow stars | t  stars - STAR | stars STAR  a. Although the grade file CFG given above is not LL(1), some correct inputs can be parsed by a predictive parser. This is because those inputs never cause the parser to look at a table entry that contains two or more CFG rules. However, the TAs ran into problems parking this file al some point in the course because the CFG is not LL(1).  Give the shortest such grade file input (as a sequence of tokens, ending with EOF).  Draw the parse tree that the parser would build for the input you gave for Part (i). (Do not include the EOF token in the parse tree.)  b. What is the earliest point in the course at which the parser broke? (i.e., a sequence of tokens that is a prefix of a valid input. but for which the parser would not know how to continue to build the parse tree top-down because it looks at a table entry that contains two or more CFG rules)? To answer this question, give all of the following:  The sequence of tokens (a prefix of a valid input).  The (partial) parse tree that the predictive parser would have built before being stumped.  The CFG rules that the predictive parser can\'t choose between to continue to grow the parse tree.  c. One problem with the grade file CFG is that it has not been left factored. Find the CFG rules with a common prefix and transform them by doing left factoring.  d. Another problem with the grade file CFG is that is has immediate left recursion. Find the CFG rules that cause this and transform them to remove the left recursion. 
  
  Solution
public class Test { public static void main(String args[]) { int a, b; a = 10; b = (a == 1) ? 20: 30; System.out.println( \"Value of b is : \" + b ); b = (a == 10) ? 20: 30; System.out.println( \"Value of b is : \" + b ); } }
