Language generated by a grammer

  • Thread starter Thread starter Movingon
  • Start date Start date
  • Tags Tags
    Language
Click For Summary
SUMMARY

The discussion centers on determining the type of language generated by a formal grammar, specifically the grammar defined by the rules S → aSb, S → ab, which generates the language a^n b^n. Participants highlight the utility of the Chomsky hierarchy for classifying languages based on their grammar forms. The conversation also introduces a more complex grammar G = ({S, X}, {a, b}, P, S) with rules P = {S → aaSbb | X | ε, X → Xb | ε}, which generates the language L = {a^n b^{2n+m} | n ≥ 0, m ≥ 0}. The key takeaway is that while inspecting grammar forms can provide insights into language classification, precise language descriptions may require rule application.

PREREQUISITES
  • Understanding of formal grammar concepts
  • Familiarity with the Chomsky hierarchy
  • Knowledge of language generation techniques
  • Basic understanding of context-free grammars
NEXT STEPS
  • Study the Chomsky hierarchy in detail
  • Learn about context-free grammars and their properties
  • Explore techniques for language description and classification
  • Investigate parsing algorithms for context-free languages
USEFUL FOR

Computer scientists, linguists, and students of formal language theory who are interested in understanding language generation and classification through formal grammars.

Movingon
Messages
4
Reaction score
0
Ok I have a simple question. Let us say we have a formal grammar, let us take this simple example:

S → aSb
S → ab

This grammar generates language [itex]a^n b^n[/itex]. My question is, is there a way I can tell what kind of language this generates from the rules? I can of course apply the rules and find out this grammar can generate such a language but sometimes we may have more complex examples containing more rules. So my questions is, how can we then find out exactly the kind of language generated by a given grammar without having to manually apply rules as this may not be always practical? Thanks in advance!
 
Technology news on Phys.org
"exactly the kind of language generated by a given grammar" is perhaps not precise enough to know exactly what kind of answer you want given any arbitrary grammar.

You can, by inspecting the form of the grammar and not manually applying the rules, probably determine which level of the Chomksy heirarchy the language resides in.

A few seconds of searching turns up one reasonable description of the heirarchy.
http://www.answers.com/topic/chomsky-hierarchy
There are many other well written descriptions of this out there.

If, as I suspect, you are looking for a more precise description of the language than this then I suspect the answer may be that you cannot determine this in every case by just inspecting the form of the grammar.
 
Thanks. Yeah what I meant was describing more precisely and formally a language generated by a certain grammar, the Chomsky hierarchy I already know of. For example, you are given a grammar as follows: G = ({S, X}, {a, b}, P, S) with the rules:
P = {S → aaSbb | X | ε, X → Xb | ε}.

where ε here stands for the empty string. You are asked to find out and describe formally the language generated by this grammar. As it turns out, this grammar generates language [itex]L = {a^n b^{2n+m} | n \geq 0, m \geq 0}[/itex]

So my question is, how could I, for example, figure out that this grammar generates this language? Do I have to apply those rules and then from the result find out the kind of language generated? Is this the only way to find out a language L generated by grammar G?
 

Similar threads

  • · Replies 8 ·
Replies
8
Views
3K
Replies
65
Views
5K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 26 ·
Replies
26
Views
2K
  • · Replies 133 ·
5
Replies
133
Views
12K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 40 ·
2
Replies
40
Views
9K
  • · Replies 10 ·
Replies
10
Views
2K