views:

81

answers:

1

Hi All,

Is there any specific methodology followed to specify a language for given grammar ?? i.e. Is it necessary to run all the production rules given in a grammar to determine the language it represents? I don't have an example as such since the one I am working on is a homework question.

[edit]: adding an example, Describe, in English, the language defined by the grammar

    <S> -> <A> <B> <C>
         <A> -> a <A> | a
         <B> -> b <B> | b
         <C> -> c <C> | c

Regards,

darkie15

+1  A: 

In you example, the part

<A> -> <A> a | a

recognizes exactly non empty lists of a The same goes for the two other productions, <B> and <C>, with respectively b and c.

Thus, with <S> -> <A> <B> <C>, you deduce that the language this grammar recognizes is any non empty list of a, followed by a non empty list of b, then a non empty list of c, corresponding to the regular expression a+b+c+.

Proof is quite easy from there to show that each instance recognized by the regular expression is recognized by the grammar, using induction.

tonio