"Concepts Problems (60 points)
Consider the following context free grammar describing a simple assignment statement. (60 points)
<assignment> → <identifier> = <expression> ;
<expression> → <expression> + <term>
| <expression> - <term>
| <term>
<term> → <term> * <factor>
| <term> / <factor>
| <factor>
<factor> → ( <expression> )
| <identifier>
<identifier> can be any valid Java variable name. Red text in a box indicates a terminal symbol.
Show a parse tree and a leftmost derivation for each of the following statements. (20 points each)
a) i = (b1 - b2) / (c+d) ;
b) j = c/ (b1 - b2) ;
c) k = (c + d_z) * a;
ANTLR Problems (40 points)
Use ANTLR to create a parser as a standalone Java application for the language specified by the grammar in Concept Problem 1. (20 points)
Modify the ANTLR grammar in ANTLR Problem 1 to accept integer and floating point constants as well as multiple assignment statements and create the corresponding parser as a standalone Java application. (20 points)
Submission
You must provide explanations for the answers. Source code files must include comments. An answer without an explanation is worth 0 points.
You are encouraged to use Generative AI (Microsoft Copilot only). If you use Generative AI, you must describe the process and include the prompts used.
When preparing answers, you can draw figures by hand and scan them. However, please make sure the scanned figures are clear and easy to read.
Submit (upload) your solutions as a single ZIP archive file named hw1PID.zip. For example, my PID is gracanin so my file would be called hw1gracanin.zip. The ZIP archive must contain the following files:
hw1concepts.pdf: answers to Concept Problems (PDF format) and relevant information about ANTLR problems solutions and use of Generative AI (as needed).
HW1.g4: ANTLR grammar for ANTLR Problem 1.
HW1.java: the main Java class for ANTLR Problem 1.
HW1multi.g4: ANTLR grammar for ANTLR Problem 2.
HW1multi.java: the main Java class for ANTLR Problem 2."
Above is our homework. Reading each line attentively, then write the code for each files