Answered step by step
Verified Expert Solution
Question
1 Approved Answer
create a c program that fulfills the requirements 1. Prompt the user to enter a filename to parse. This file should be opened, checked to
create a c program that fulfills the requirements
1. Prompt the user to enter a filename to parse. This file should be opened, checked to make sure it was correctly opened, and closed. 2. Detect the comments denoted by // (comments surrounded by // are extra credit). Since comments are ignored by compilers, we will not look at characters such as \{(D)) that appear within comments. 3. Detect and track the {(D)} characters. Ensure that: a. For every {([ there is a ])} b. That the order that these characters appear follows C syntax rules, Specifically, the type of the last parenthesis-like opening character must be matched with a closing character of the same type, before any other parenthesis-like character appears. Valid combinations include: {(Z]} and {((O)]D){}. Invalid combinations include: {(}) and {([}). c. Hint: The best data structure to solve this problem is a stack. You can implement this stack using an array. 4. Output: a. If there are no syntax errors, follow the gcc tradition and print absolutely nothing. b. If there is a syntax error, report the line number on which it was detected, and give as specific of an error message as you can Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started