# Math Help - Is that an adequate description of a language described by a grammar?

1. ## Is that an adequate description of a language described by a grammar?

Given the following grammar I have been asked to describe the language it generates:
$S \rightarrow aT$
$T \rightarrow a \,|\, UTV$
$U \rightarrow ab \,|\, ba$
$V \rightarrow ac \,|\, ca$

I started with some examples:
$S \implies aT \implies aa$
$S \implies aT \implies aUTV \implies abTac \implies abaac$
$S \implies aT \implies aUTV \implies baTca \implies baUTVca \implies baabaacca$

So my description is:
A language where b's and c's are balanced (including zero of each) centred around an a, such that there will always be 1 more a than the number of b's or the number of c's.

The exact question is "What language is generated by the grammar?", given this information would you agree that this is an adequate answer?

Thanks

2. ## Re: Is that an adequate description of a language described by a grammar?

Hey alexgeek.

I don't know what is expected by your professors/lecture-persons/tutors but when I think of a language I think of the syntactic properties associated with the language whether that includes some sort of grammar, finite automata description, or markov model (or a combination of the three).

It's just a little hard to know exactly what the question is asking let alone to give an adequate answer.

Do you have another question like this that has an existing solution? Also are doing this as part of a particular course? (Compiler design, linguistics, etc)?

3. ## Re: Is that an adequate description of a language described by a grammar?

Originally Posted by alexgeek
So my description is:
A language where b's and c's are balanced (including zero of each) centred around an a, such that there will always be 1 more a than the number of b's or the number of c's.
First, this is a description of words that result from T, not S. S adds an additional a in the beginning. Second, this description is true for all words in the language of T, but it is also true of some words outside the language. Namely, it does not preclude words where c occurs in the first half or where 3 b's occur in a row.

I would describe this language as $a(ab|ba)^na(ac|ca)^n$.

It is recommended to post questions about formal languages in the Discrete Math subforum.