Write a program that does the following:1. Reads a grammar.2. Finds all FIRST(X) sets, following algorithm on pg. 189 of text.3. Finds all FOLLOW(A) sets following algorithm on pg. 190 of text.You may write the program in any language that is supported by thecomputers in the lab, but C is preferred.INPUT:A grammar G.OUTPUT:The list of all productions in GThe FIRST(X) and FOLLOW(A) sets of GDELIVERABLES:Program source code, with internal documentationTest results for grammar G417 and at least one othergrammar. NOTES:=====Follow the textual conventions on pg.198 of text.(additionally follow algorithms described in First/Follow linkon the Compilers web page or section 4.4.2 of text).A is a non-terminal.X is a grammar symbol (terminals or non-terminal).In addition we will use the following conventions:1 – all terminals will be single characters.2 – all non-terminals will be single letters.3 – epsilon (the empty string) is: e4 – the “produces” symbol in productions is: ->5 – end of input / end of section symbol is: $The format for a grammar is as follows:terminalterminal..terminal$productionproductionproduction$A first section with one terminal per line, ending in $, anda second section with one production per line, ending in $.The format of a production is:A->stringwhere the string represents a single produciton with no whitespaceor “or” symbols, and A is a single non-terminal.Sample grammar:==============Example 4.27 from the book is in ~egomez/cs570/first/g417. Thefollowing modifications are made, to conform to the format above:epsilon is replaced with e.E’ is replaced with D.T’ is replaced with U.id is replaced with I.I-> x|y|z is added; x y and z are the only identifiers.You should modify the FIRST and FOLLOW sets for this grammar accordingly(see page 222).At least one more sample grammar will be placed in the same directory.Optional features:=================You may choose to write your gramman interpreter so that it understands the “or” symbol: |You may choose to ignore whitespace for better readability.*** This assignment should be programmed in C . and if you finish this I can give some assignments in series to you.** What I attached is page 222. It will be helpful for this work.
The list of all productions
We help you get better grades, improve your productivity and get more fun out of college!!
Homework Answers Online
Free title page
Free reference page
How it works – it’s easy
Place your Order
Submit your requirements through our small easy order form. Be sure to include and attach any relevant materials.
Make a payment
The total price of your order is based on number of pages, academic level and deadline.
We assign the assignment to the most qualified tutor. When the tutor completes the assignment, it is transferred to one of our professional editors to ensure that the assignment meets all of your requirements.
Once complete, we’ll send your assignment via the email provided on the order form.