Questions tagged [context-free-language]

In formal language theory, a context-free language (CFL) is a language generated by some context-free grammar (CFG). The set of regular languages is a subset of the set of context-free languages.

183 questions
0
votes
1 answer

Context free grammar for CFL

enter code hereHallo, this is my question Give context free grammar for CFL L = {a^nb^mc^n | m, n ∈ N0} My answer is S-> ASC| B A-> aA| a B-> bB| b C-> cC| c Whether my answer or not ? I am not sure about it. Need some help. thanks in advance
0
votes
0 answers

Prove the grammar are Ambiguous

Can anyone please tell me how to prove this grammar are Ambiguous ? thanks in advance. I cannot find the string which shows the grammar are Ambiguous :( G2 = { {S}, {a,b}, {S->ab|ba|SS}, S }
0
votes
1 answer

Construct a grammar for a language

I have a question regarding this question: L= empty where the alphabet is {a,b} how to create a grammar for this ? how can be the production rule ? thanks in advance
0
votes
1 answer

classify as regular, context free, or other

Could someone answer these questions and dumb it down for me please, I am not fully grasping the ideas. I am overall confused at things like "what exactly are terminals?""What does w stand for?" but as for the real question here they are, please…
0
votes
1 answer

Nondeterministic Pushdown Automata different diagrams

In introduction to the theory of computation book, for the language a state diagram is given as : I know there could be alternative diagrams but I doubt the solution I found might be wrong which is slightly different than the original one: I…
0
votes
2 answers

Is this a context free or context sensitive language?

I am studying Formal Languages and Automata Theory, and I have a question about a problem inside the book that is not answered in it. the question is: Is this language Context Free, Regular or Context Sensitive? L={a^i b^j c^k|i<=j or j<=i , j=k}
a_m
  • 11
  • 3
0
votes
1 answer

How to generate the FIRST set of this context-free grammar

I've been trying to find the "first set" of this context-free grammar. I've come up with 2 answers but I'm unsure if they're correct. I would be grateful if someone could explain how to generate the first set of this grammar. Both answers are…
0
votes
0 answers

Eliminating epsilon rules

Hi I have the following CFG S -> aA | bC | CC A -> B B -> S | epsilon C -> A | S I have managed to remove the epsilon resulting to: S -> aA | bC | CC | a | b | C A -> B B -> S C -> A | S Im in the point of removing unit rules and it resulted in…
0
votes
1 answer

Trying to prove that the complement of {a^i b^i c^i} is a context-free

I'm trying to prove that the complement of L= {a^i b^i c^i : i >= 1} is a context free. L complement is: {w is a word over {a,b,c}* : w not in L}. As we know, context-free languages are closed under union. So, I'm trying to divide my language…
AIM
  • 137
  • 1
  • 1
  • 5
0
votes
1 answer

Why the following language satisfies the pumping lemma for cfl

L = {a^n b c^n| i is greater than 1 and less than 100 , n is greater than 1} I think i misunderstood the pumping lemma for cfl. why cant i pick a word z = a^n c b^n then break it apart to u= a^s v = a^n-s w=epsilon x=b ,y= b^n then pump it with i=0…
gil
  • 2,388
  • 1
  • 21
  • 29
0
votes
2 answers

Chomsky Normal Form Conversion Algorithm

Why do we add a new start state S0 -> S when we want to convert a grammar to Chomsky normal form? What goes wrong if we do not do that? At first I thought it's because of epsilon rules. But we do not remove an epsilon rule from start variable. So,…
0
votes
1 answer

What formalism doesn't belong and which are more powerful/equal

I have this list of formalisms and i need to order them according to their expressive power, also one of them doesn't really belong. Context-free Grammar(CFG) Deterministic Finite Automata(DFA) Deterministic Pushdown Automata(DPDA) LR(0)…
0
votes
2 answers

understanding basics of CFG

Have just started the chapter about CFL in Sipser's book and already fail to understand the basics. Let this be the grammar of some language: S -> A0A A -> 00A | 11A | 10A | 01A | e I am really confused about this A0A part. Does it mean that the…
0
votes
0 answers

{a^nb^n} union {a }is deterministic or not

I am confused according to me it should not be deterministic as there will be states for (a,zo/azo) going to q1 and (a,z0/eplison) going to final state. Is this true or not
0
votes
1 answer

Context free grammars with nesting and inequalities

I've been unable to find any examples of context-free grammars that have nesting and inequalities. For instance, I am trying to write the CFG for: {aibjckdl : (i < l) ^ (j < k)} So, for {aidl : (i < l)}, the CFG would simply be: S -> aSd | dS | d It…