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
2 answers

Context Free Grammar Design

I'm learning about Context Free Grammars, and I've been understanding them so far, but this problem is kind of making my head spin. I have the following rules: S --> aSb | bB | epsilon B --> bbB | bB | epsilon And I'm almost certain that they are…
0
votes
0 answers

How to show every context free language with a certain form?

How can I show that every context-free language can be generated by a grammar in which every production is of the form A → a,A → aB,A → aBC where a is a terminal, and A,B,C are variables?
0
votes
1 answer

Implement a parser from a grammar for makefiles

I have to write a parser for some makefiles without variables and symbols (\$@, $< etc.), all they contain are Rules as : Target: Dependencies [tab] Commands According to Makefile Grammar , the grammar of Makefile in general is context-sensitive…
0
votes
1 answer

L = { a^n b^n c^m d^m : n >= 1, m >= 1 } U { a^n b^m c^m d^n : n >= 1, m >= 1 } isRegular?

there is a lot of examples for pumpinglemma proof, but I did not figure out this, can anyone help ? L= { a^n b^n c^m d^m : n >= 1, m >= 1 } U { a^n b^m c^m d^n : n >= 1, m >= 1 }
0
votes
0 answers

Find a Context-Free Grammar

I need to find a context-free grammar for the following language: L = { a^m b^m c^k | k <= m } (in order to show that the language is context-free)
Melissa
  • 55
  • 7
0
votes
1 answer

Prove that the language is context free

How can we design a PDA for the language L= {w | number of 010s in w is more than the number of 101s} to prove it is context free
0
votes
1 answer

How to make this context free grammar unambiguous?

The language is all binary strings of the form (0^i)(1^j) where 2i >= j. In other words, the set of binary strings where there is at most twice as many 1's then 0's and all the 0's are leading. My attempt: S -> 0S | T T -> 0T1 | U U -> 0U11 |…
0
votes
1 answer

CFL Pumping Lemma L = {a^n b^m c^k d^k | n>m}

I have some troubles solving this exercise with context free pumping lemma. Can someone help?
0
votes
1 answer

Prove that the following language is not a context-free

L = {a^i b^j c^k; i≠j and i≠k and j≠k}. First approach: I tried two different string to prove it by pumping lemma but non of them is correct. first w = a^m b^m+1 c^m+2 and m is pumping length. for example one case in w = uvxyz is that vxy in is a…
Pedram
  • 1
0
votes
1 answer

Proving that a language is not a context free using pumping lemma?

I am trying to prove that the language L = {a^n! | n>=0} is not context free using pumping lemma. But i am stuck at how to divide into uvxyz itself. Since its only one symol i find it very tricky.
Bipul Adh
  • 103
  • 1
  • 2
  • 6
0
votes
1 answer

Context free language (Pumping lemma a^n b^m c^min(n,m))

I'm struggling to solve the following problem. I'm supposed to use the pumping lemma. To prove {a^n b^m c^min(n,m) | m,n >= 0 } is not Context Free.
user8891173
0
votes
1 answer

L = { 1 ^ n (n+1) / 2 } is context free ?

I noticed the the language L generates words with a length that represents trianglar numbers: 1,3,6,10,15 etc.. I'm trying to use the pempingt lemma for w=1^(p(p+1) but I didnt reach anywhere.. Can someone help or give me an idea how to solve it…
0
votes
1 answer

How to convert to Chomsky Normal Form quickly?

So I know the basic 4 step way of doing it. Removing the epsilons, then the variables less than 2 and so on. However, that way takes way too long for the problems we will have to do on the test. Here is an example: Convert this context-free…
0
votes
1 answer

1 or 2 right hand side variable in Context free language

I have 2 questions to ask and I have some ideas about it also. 1) X-Context free grammer(X-CFG) with 1 terminal or variable at the right hand side of every rule. 2) Y-CFG with 2 terminal or variable at the right hand side of every…
MadMax
  • 306
  • 1
  • 5
  • 17
0
votes
1 answer

Generating grammar which contains all the alphabets

I need to construct a CFG for the language which can generate any phrase containing all symbols. S -> ABC A -> a,b,c,d.........z | B B -> .,?,-,=,.... | C C -> A | epsilon I think it's not right. is there anyway to make it work so it can generate…