CS301 LAB 1 Write a program in C++ that takes in one or more Context Free Grammars and outputs the grammars in Greibach Normal Form. The input file will be Grammar.in. You should create an output file called Grammar.out. You should create a USER-MESSAGE that tells the user how to execute your program. The program must be tested and execute on a Unix machine at CSU. If we must ask you how to execute your program, there is a 15 point penalty. The program can be broken down into (at least) 3 major tasks. One task is to put the rewrite rules in "ordered form". "Ordered form" is defined to be such that the leftmost symbol on the right hand side of every rule has a Terminal or a "higher order" Nonterminal compared to the Left-Hand-Side Nonterminal. To get partial credit your program must do something. Non-working code will get a 0. At least one test case will have no recursion. 40 points will be given for just outputting a revised set of rules in "ordered form". (This can also be done for Grammar 2 without solving for recursion.) The second major module is to remove recursion. 70 points will be given if you output a revised set of rules in "ordered form" with the recursion removed. The third major module will be to do the final substitution that puts the grammar in Greibach Normal Form. Please document your code. Describe objects and subroutines. EXAMPLE ============================ Grammar.in ============================ GRAMMAR 1 TERMINALS: x, d, a NONTERMINALS: S, A, B, C START: S Order: S, A, B, C S -> xA A -> BBB A -> BC B -> Ad B -> a C -> x GRAMMAR 2 TERMINALS: a, b NONTERMINALS: A, B, C START: A Order: A, B, C A -> BC A -> CA B -> b C -> AB C -> a END /* File will terminate with the word END */ =========================== Grammar.out =========================== GRAMMAR 1 TERMINALS: x, d, a NONTERMINALS: S, A, B, C, R START: S S -> xA A -> aBB A -> aC A -> aRBB A -> aRC B -> a B -> aR C -> x R -> aBd R -> aBdR R -> aRBd R -> aRBdR R -> xd R -> xdR GRAMMAR 2 TERMINALS: a, b NONTERMINALS: A, B, C, N START: A A -> bC A -> bCBA A -> aA A -> bCBNA A -> aNA B -> b C -> bCB C -> a C -> bCBN C -> aN N -> bCB N -> bCBAB N -> aAB N -> bCBNAB N -> aNAB N -> bCBN N -> bCBABN N -> aABN N -> bCBNABN N -> aNABN