Re: Can some one help me in this Question?
- From: Rick Decker <rdecker@xxxxxxxxxxxx>
- Date: Thu, 03 May 2012 17:11:34 -0400
On 5/3/12 10:03 AM, Mahira Anwar wrote:
On May 3, 6:15 pm, Joshua Cranmer<Pidgeo...@xxxxxxxxxxxxxxx> wrote:On 5/3/2012 5:24 AM, Mahira Anwar wrote:
Hello Every One,
Can Some one help me in the below Question Please?
Consider the following grammar;
S --> XaYb
X --> bXc | b
Y --> dYa | d
Find the first sets for each non-terminal of the given grammar.
Do you know what a first set is? Logically speaking, the first set for
any nonterminal is the set of all terminals which could comprise the
first element. In other words, if a production A -> b starts with a
terminal, it has to be that b is in A's first set. If a production
starts with a nonterminal, what should its first set be?
--
Beware of bugs in the above code; I have only proved it correct, not
tried it. -- Donald E. Knuth
Ok Thanks a lot Joshua. Now I understand it, Can you please help me
in the below Question?
Consider the following grammar and construct the corresponding parse
tree for string “aabbabab”.
S ―> aSSb | bSSa | ε
Here's a start. Which of your productions must be applied to S
to get a string starting with a and ending with b? Clearly
S -> aSSb
So you have the initial a and the terminal b, so exclude them
and your next step is to ask how are you going to get
"abbaba" from SS? The only way to get the initial a is to use
S -> aSSb
again, so continue asking these questions until you're done.
You will be faced with some choices along the way, but it
shouldn't take too long before you get the correct derivation.
Regards,
Rick
.
- References:
- Can some one help me in this Question?
- From: Mahira Anwar
- Re: Can some one help me in this Question?
- From: Joshua Cranmer
- Re: Can some one help me in this Question?
- From: Mahira Anwar
- Can some one help me in this Question?
- Prev by Date: Re: Can some one help me in this Question?
- Next by Date: Leading programming books solution manuals and test banks for practice for sale! electronic delivery.
- Previous by thread: Re: Can some one help me in this Question?
- Next by thread: Leading programming books solution manuals and test banks for practice for sale! electronic delivery.
- Index(es):
Relevant Pages
|