Hello, I'm new to context free languages and having trouble converting from a mathematical description of a language into the CFG syntax. For example, if I'm asked to find (a^n)(b^n) for n greater or equal to zero, that is a language that has the same number as a's as b's that begins with "a", i know that I can write the context language as:
S-->aSb | e
How do I handle a situation where I have something like:
(a^m)(c^p)(d^q) such that m = p + q.
Anyone have an idea??
Thanks
2006-10-23
16:28:22
·
1 answers
·
asked by
mdigitale
7
in
Science & Mathematics
➔ Mathematics
Thanks for your response. I'm always amazed how simple little things can bring the full picture to a whole new light. I'm not quite sure if this is all there is to it? For example, what would happen if m was chosen to be 1...therefore p OR q must be 1.
So valid strings would be ac or ad
And the rule would be quite simiple
S-->ac | ad
I don't know why these things are so difficult for me to visualize. I feel like I should be able to write a general CFG that encompasses the m = p + q condition not dependant upon the actual values chosen? Am I off base here?
2006-10-23
17:37:14 ·
update #1