Write a Java program that performs Recursive Descent Parsing on the LL(1) grammar you have previously produced. Your parser gets its tokens from a file (instead of receiving them from a scanner). When the parsing activity terminates, your program should display one of the following messages: SUCCESS: the code has been successfully parsed (in case of success) ERROR: the code contains a syntax mistake (in case of failure) Three input files containing a list of tokens have been attached to this assignment. The first one is called input1.txt and contains no syntax errors. The second and third are called input2.txt and input3.txt and contain syntax errors. In these files, each token is written on a separate line. Therefore, in order to get a token from the file, you can simply use a readline () call.
LL(1) grammar
123 T in 17 <
2 <statement_list> ::= <statement> <statement_list'>
3 <statement_list'> ::= ; <statement> <statement_list '> | <
4 <statement> ::= compute: <expression> | call: <procedure_call>
5 <procedure_call> ::= id ( <parameters> )
6 <parameters> ::= <factor> <parameters'>
7 <parameters'> ::= <factor> <parameters'> | ε و
8 <expression> ::= id <factor> <expression'> =
<expression'> ::= + <factor> <expression'>] <factor> <expression'> | <
10 <factor> ::= id| num
Write a Java program that performs Recursive Descent Parsing on the LL(1) grammar you have previously produced. Your parser gets its tokens from a file (instead of receiving them from a scanner). When the parsing activity terminates, your program should display one of the following messages:
SUCCESS: the code has been successfully parsed (in case of success) ERROR: the code contains a syntax mistake (in case of failure)
Three input files containing a list of tokens have been attached to this assignment. The first one is called input1.txt and contains no syntax errors. The second and third are called input2.txt and input3.txt and contain syntax errors. In these files, each token is written on a separate line. Therefore, in order to get a token from the file, you can simply use a readline () call.
Note that the developed Java program should receive the name of the file as an argument passed to its main method. Also, make sure to include your .java files as part of your assignment submission.
![](/static/compass_v2/shared-icons/check-mark.png)
Step by step
Solved in 4 steps with 5 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)