Question: USE JAVE PLEASE AND MAKE IT SO IT PROMPTS THE USER FOR A TXT FILE AND READS THE FILE Project Problem: Simplification of Context-Free Grammars

USE JAVE PLEASE AND MAKE IT SO IT PROMPTS THE USER FOR A TXT FILE AND READS THE FILE

Project Problem: Simplification of Context-Free Grammars We learned three context-free grammar (CFG) simplification techniques in our classes: removing -rules, unitrules, and useless rules. In this project, read a CFG from a txt file, simplify it by removing -rules and useless rules, and print out the simplified equivalent CFG. No need to care or remove unit-rules. For example, given the following CFG in a txt file (0 denotes empty string and - denotes arrow head ):

S-aA|aBB

A-aaA|0

B-bB|bbC

C-B

After processing, your program should print out the following simplified equivalent CFG:

S-aA|a

A-aaA|aa

Note that the program must be able to work for any CFG, 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!