Question: Write the C++ driver that implements the parenthesis matching algorithm in order to read the file name from the user and parse it to generate
Write the C++ driver that implements the parenthesis matching algorithm in order to read the file name from the user and parse it to generate compilation errors related to the parentheses.
This is how the program should work :
If addNums.cpp contains the following text:
- #include
- #include
- using namespace std;
- int main() {
- int x = 20;
- int y = 30;
- int x1[ = {1,2,3;
- if (x > y)
- cout<<"X is greater than Y";
- else
- cout<<" Y is greater than X";
- return 0;
- }
Run:
Enter file name: addNums.cpp
Parser Results:
1. ERROR-4: EXPECTED } TO MATCH {
2. ERROR-6: EXPECTED ] TO MATCH [
2 errors generated.
BUILD FAILED
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
