hi there everybody,

I have to make a program that gets a string and then finds out if it is accepted by the CFG(cintext free grammer),
I want to first do the Simplification of CFG but I really don't know what data structure I have to use,
for example I want to get rid of useless symbols(those that do
not participate in any derivation of a terminal string.)
here i have the file that keeps the grammer for example
then I have to get ride of B cuz not genarating termenals so the grammer would be :
then get rid of A cuz not reachable from S,so:

so how cud I do this with coding?

thank you

thanks for your help,
I look at these pages,so the implementation is with a tree,
I'll read all,nice information,

This article has been dead for over six months. Start a new discussion instead.