1.11M Members

Simplification of CFG what data structure

 
0
 

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
S>AB
S>a
A>b
then I have to get ride of B cuz not genarating termenals so the grammer would be :
S>a
A>b
then get rid of A cuz not reachable from S,so:
S>a

so how cud I do this with coding?

thank you

 
1
 
 
0
 

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

You
This article has been dead for over six months: Start a new discussion instead
Post:
Start New Discussion
Tags Related to this Article