Question: You will implement a syntax - checking program that mimics a function of a compiler. While compilers identify syntax errors, they often generate numerous diagnostic

You will implement a syntax-checking program that mimics a function of a compiler. While compilers identify syntax errors, they often generate numerous diagnostic messages when a single symbol is missingsuch as a missing brace or comment startermaking it difficult to pinpoint the actual issue. To address this, your program will check for balanced symbols. This means that every right brace, bracket, and parenthesis must correspond to its left counterpart. For example, the sequence [()] is valid, while [()]) is not. Your program should be implemented in following: 1) Read a file (ex: HelloWorld.java or HelloWorld_wrong.java) as an input file - HelloWorld.java 2) Check syntax errors [pair of []{}, and ()].3) Display output (ex: No syntax error,Syntax errors occurred) Test Scenarios: 1) If the input file is HelloWorld.java, the output should be No syntax errors.2) If the input file is HelloWorld_wrong.java, the output should be Syntax errors occurred.3) For your sample test file: o If the file contains syntax errors, the output should be Syntax errors occurred. o If the file does not contain syntax errors, the output should be No syntax errors.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!