# How do I define a language from a grammar?

Given an alphabet $Λ = \{a, b, c\}$, I have the following grammar:

$$S -> aSb | aAb$$ $$A -> aaA | aBb$$ $$B -> Bbb | c$$

Which method should I use to write the definition of the language?

• What do you mean by "write"? The generated language is defined by the semantics of formal grammars; check that definition. – Raphael Jan 29 '17 at 22:34
• I mean "write the definition of the language", there are no other meanings. From the definition of a language you can write a grammar that generates that language. I need the opposite task, from a grammar to the definition of its language. – emaph Jan 30 '17 at 11:39
• $L(G)$ is a definition of the language. – Raphael Jan 30 '17 at 12:50
• I needed a definition like this: $L = \{a^naa^{2m}acb^{2p}bbb^n | n, m, p ≥ 0\}$ – emaph Feb 1 '17 at 12:17

This one is very simple because it has a very downward flow to it. For example, $S$ has non-terminals $S$ and $A$, and once you go to $A$, you can never get back to $S$. So we use this fact to just work through incrementally.
Our language started with $a^nXb^n$ for S where X is some other language, then we got to A and get $a^n(aa)^mXb^n$, then finally $a^n(aa)^{m+1}c(bb)^sb^{n+1}=a^{n+2m+1}cb^{n+2s+1}$ where $n,m,s \in \mathbb{N} \setminus{0}$