ParamList Tail » Рaram Par” src=”https://files.transtutors.com/cdn/qimg/754b3b4b3c5640d6987673c468fe053b.jpg” aria-describedby=”fu3″>

1. Consider the grammar in Figure 1 (a) [5 marks] Give a parse tree for the following program fragment def fib n) { if less than( n, 2 ) ) { return n return add fib( sub( n, 1 ) ), fib( sub( n, 2 ) ) } (b) [5 marks] Is this grammar ambiguous? Give an intuitive justification (c) 10 marks] Prove that this grammar is not LL(1). Hint: You can do this by constructing the FIRST, FOLLOW, and PREDICT sets. (d) [10 marks] Modify the grammar so that it is LL(1) ‘def id ‘ParamList ‘)’Block MethodDecl ParamList ParamList – Param ParamList Tail ParamList Tail > ParamList Tail » Рaram ParamList Tail Param id ‘Statements ‘ Block Statements Statements Statement Statements Statement IfStatement Statement ReturnStatement if ‘Earpression ‘Y Block Else IfStatement Else else’ Block Else ‘else’ IfStatement ‘return’ Eapression Else Return Statement – Earpression integer Erpression id id ‘(‘ ArgList ‘ Erpression ArgList Earpression ArgListTail ArgList ArgList Tail ‘Arg ArgListTail ArgListTail Arg Expression Figure 1: A Grammar for function definitions.