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.
Questions tagged [context-free-language]
183 questions
0
votes
0 answers
L = {www| w belongs to {0,1}*} prove via pumping lemma
Is the language given below a CFL? If not prove via Pumping Lemma.
L = {www| w belongs to {0,1}*}
That much I know that it's not a cfl! But I'm facing difficulty solving it via pumping lemma. Kindly help me

hyeri
- 663
- 9
- 26
0
votes
1 answer
Approach to finding the context free grammar of more complicated languages
I'm having problems approaching the following problem.
Give a context free grammar for the following language:
{x#y | x,y in {0,1}* and |x| != |y|}
What is the best way to approach this question? At the moment I'm just using intuition to solve…

kw3rti
- 204
- 2
- 11
0
votes
1 answer
Are these context free grammars equivalent?
The language is {w|w has an odd length} and the alphabet is {0,1}.
I came up with a solution of
S->1p|0p|e
p->00p|11p|01p|10p|e
and the book has
S->0|1|0S0|0S1|1S0|1S1
are these equivalent?

TemporaryFix
- 2,008
- 3
- 30
- 54
0
votes
1 answer
Why this context-free grammar language doesn't fit?
The problem is to provide context free grammar where L={w∈{a,b}∗∣the number of a's in w is one bigger than the number of b's}.My solution is
S -> LaL
L -> aLb|abL|bLa|Lab|Lba|baL|_
Can anyone tell why my solution doesn't work for this language?

Blake
- 7,367
- 19
- 54
- 80
0
votes
0 answers
How to check if a language is regular, context-free, det. context-free or type-0
I have to decide for several languages whether they are regular, context-free, det. context-free or type-0. I understand how to show a language not to be regular (using the pumping lemma), but how to decide it for the other language types very…

jannnik
- 102
- 1
- 13
0
votes
1 answer
Is the complement of a non regular language always a recursive language?
Is the complement of a non regular language always a recursive language?
I understand that
1.context-free languages are not closed under complement.
2.recursive enumerable languages are not closed under complement.
3.recursive languages are indeed…

Wanderer
- 253
- 1
- 12
0
votes
2 answers
Union of Deterministic Context Free Language and Regular Language results?
Given L1 is Deterministic context free languages & L2 is Regular language.
L1 U L2 results DCFL or regular?
please give some examples with the context

roggy
- 64
- 1
- 1
- 7
0
votes
1 answer
context-free matching of characters
Given the three symbols: "(" ")" and ";"
how can I create production rules of a context free grammar for S expressions, which meet the following criteria:
The whole expression is nested in brackets, which means it starts
with "(" and ends with…

Sunshine
- 27
- 6
0
votes
1 answer
Some constraint on Language and CFG
I see one note about automaton theory:
Consider the following language:
L={xy : x,y in {a,b}*}
and consider following constraint:
1) x=y
2) x != y
3) x=(y)reverse
4) number of x is not equal to number of y
i read a language with constraint…
user3929084
0
votes
1 answer
Construction of a context free grammar
So, I have this language L={a^i b^2j+1 / i<>j} and I have to generate a context free grammar based on it, can you please help me in illustrating the steps in doing that.
So far I have this:
S-->aS/aBbb
B-->bB/b/e(empty)
but I am not sure if…

southpaw93
- 1,891
- 5
- 22
- 39
0
votes
1 answer
Pushdown Automata for an intersection?
I have a question about designing a pushdown automata for the language:
L = { w in {a, b}* : 2n_a(w) <= n_b(w) <= 3n_a(w) }
In other words, the number of b's in w is "between" 2 times the number of a's and three times the number of a's.
I'm…

Farzad
- 1,770
- 4
- 26
- 48
0
votes
0 answers
Given a language a^n b^m such that n and m have some relation between them implies that the given language can not be regular.Am i correct?
I know what regular and context free language are and how regular language needs finite memory, and other related stuff. What concerns me is that I think if an bm such that n and m have some relation between them then they can not be regular, but I…

sandeep bisht
- 111
- 12
0
votes
1 answer
Finding a grammar for this language
I need to find a context free grammar for the following language:
L= { w from { a,b,c,d }* : #a+2#b=2#c+#d }
Here is my attempt, but I doubt it is correct:
S -> aSd|dSa|BSC|CSB|abSdc|baScd|dcSab|cdSba|SS|λ
B -> c|dd
C -> b|aa

m0s
- 4,250
- 9
- 41
- 64
0
votes
1 answer
Defining a context-free grammar for a specific language
I have a language where each string in the language has even amount of 0's as 1's (eg. 0101, 1010, 1100, 0011, 10 are all in the language). I was hoping to define a context-free grammar that describes this language. After defining a context-free…

Andrew Reynolds
- 3
- 2
0
votes
1 answer
Converting to chomsky normal form, eliminating epsilon
I have a following CFG rule :
S -> BSA | epsilon
A -> abC | a | c
B -> baC | b | epsilon
C -> aCc | AB | epsilon
I am on the epsilon elimination stage of the algorithm, I have eliminated following eplsions C -> epsiolon, B -> epsilon and here is…

Solix
- 1,076
- 2
- 9
- 13