Question: Project Problem: Simplification of Context - Free Grammars We learned three context free grammar ( CFG ) simplification techniques in our classes removing e -
Project Problem: Simplification of ContextFree Grammars We learned three context free grammar CFG simplification techniques in our classes removing erules, unit rules, and useless rules. In this project, read a CFG from a txt ble simplify it by removing rules and useless rules, October Project of CSC F Dr Zu Page of and print out the simplified equivalent CEG. No need to care or remove unitrules, For example, given the following CFG in a text file O denotes empty string and denotes arrow head" SABB AAAA BB bbc C After processing your program should print out the following simplified equivalent CFG: SaAa Aaa The following are a few more examples you can use to test your program I highly recommend that you come up with more examples to make sure the correctness of your program: SABCD Aa Bb COC DOld For the above CE the print out should be Saubah BatAaBaba AlbaBachAaBabwbbAshDRahDAaBubDCBD:AACHDBachd AaBach Aa Bb Cc Dd SAaB A BbuLambda Iota Omicron For the above CFG the print out should be Sa Balaa Bha SASAB ABS B For the above part of the transition table of a NFA, the print out should be SASAB SAAS ABS a Bb Note that your program must be able to work for any CPG not only just for the above given examples
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
