# Re: Can some one help me in this Question?

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

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
.

## Relevant Pages

• Re: Newbie: FIRST set
... An LL parser computes the FIRST and FOLLOW sets to determine which rule ... the FIRST/FOLLOW set are set of Terminals. ... I need the FIRST set to determine which Terminal is possible next in an ...
(comp.compilers.tools.javacc)
• computing the first set (concretely)
... I know how to compute the first set however I am conflicted on how I ... should represent the syntactical specification of my language in order ... the rows are indexed by a particular nonterminal to find all terminals ... expr: expr '+' digit; ...
(comp.compilers)
• Re: Can some one help me in this Question?
... Do you know what a first set is? ... any nonterminal is the set of all terminals which could comprise the ... if a production A -> b starts with a ...
(comp.theory)
• Re: Can some one help me in this Question?
... Find the first sets for each non-terminal of the given grammar. ... 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. ...
(comp.theory)
• Re: Null terminated strings: bad or good?
... Obviously, if we don't keep track of the length of the string, there ... by ASCII not to have any visible glyph for precisely the reason that C ... and quite a few terminals had 'display all' for debugging. ... The NUL character has no use in a file containing ...
(comp.lang.c)