each message is followed by a description some examples and a determin
Write a C program, called msg.c, that reads messages from an input file (or stdin) and verifies whether the messages are valid or not. We developed a protocol for reading messages from a device. There are different length messages. Each message has rules, described below. Messages are separated by anewline.. Each message is followed by a description, some examples, and a Deterministic Finite State Automaton (DFA) which recognizes the message. Before input is read, we are instate 1. We transition states on each character read. If, at the end of input, we are in an accepting state (double circle), then the message is valid. E201022011101F Starts with an E followed by a string of digits 0 1 or 2 followed by an F. E.g.:
Starts with a P, followed by arbitrary number of BC (including none). E.g.:
Starts with a Q . Followed by a string of 6 and 7, where the number of 7 s must be odd.E.g.: Q7 Q76767 Q66666676666
ork: Starts with an M, followed by a foo or an eep. E.g.: MPBC ME2010201F
Input You will read input from the filename provided as the first argument on the command line. If you cannot open it for reading, print a meaningful message, and quit. If no filename is provided,you will read from stdin . Note, stdin is of type FILE*, and can be read exactly like a file. Output Print out the message, followed by a space, then OK if the message is valid, FAIL otherwise.One per line. Hints You maybe find these helpful. If you do not, that is okay. They are not directives. Read each line, parse the string, or Use fgetc(), parse the input directly Make a function for each message foo: еер: op:
*The amount will be in form of wallet points that you can redeem to pay upto 10% of the price for any assignment. **Use of solution provided by us for unfair practice like cheating will result in action from our end which may include permanent termination of the defaulter’s account.Disclaimer:The website contains certain images which are not owned by the company/ website. Such images are used for indicative purposes only and is a third-party content. All credits go to its rightful owner including its copyright owner. It is also clarified that the use of any photograph on the website including the use of any photograph of any educational institute/ university is not intended to suggest any association, relationship, or sponsorship whatsoever between the company and the said educational institute/ university. Any such use is for representative purposes only and all intellectual property rights belong to the respective owners.