Questions tagged [formal-languages]
Questions related to formal languages, grammars, and automata theory
2,877
questions
0
votes
0
answers
38
views
Is the language of an equal number of as bs and cs context free?
The following question appears in my textbook.
Is the language, $L$, of all words over $Σ=\{a,b,c\}$ that have the same number of $a$'s $b$'s and $c$'s context free? $L = \{abc,\ cba,\ cbacab,\ ...
0
votes
0
answers
21
views
Is the language of an equal number of as and bs followed by any number of cs context free?
Consider the language $L=\{a^n b^n c^m \mid n, m \in\{1,2,3\ldots\}\}$. Note that $n$ is not necessarily equal to $m$. Prove whether or not this language is context free.
I believe that it is context ...
1
vote
0
answers
26
views
Effect of slight modification to LL(1) parse table generation
I am experimenting with LL(1) parsers that do not use a separate lexer.
I have the following grammar:
S = (('<' S '>' | 'a'+) ' '?)+
The notation uses ' ...
1
vote
2
answers
30
views
Is garbage state necessary in DFA that enforces a particular input combination?
If I have the regex 1(0+1)* for example, then should my DFA have an arrow leading away from the starting state for when the first input is 0? I see that this regex enforces a 1 as the first input.
I ...
4
votes
1
answer
212
views
Is it possible to have intersection of L1 and L2 DFA contain states with no input edge?
I am doing a HW problem where I have L1 and L2.
I did the product construction method to produce all the new states of the DFA representing L1 and L2 (the number of states in L1 times the number of ...
7
votes
1
answer
316
views
Are Context-Free languages closed under XOR?
First, let's generalize the notion of XOR on strings over the ${0,1}$ alphabet. For strings of the same length, the XOR is the bitwise XOR. For strings of different lengths, we define $ \text{xor}(w, \...
0
votes
0
answers
15
views
Does a Moore Machine always require an output for start state?
My lecture notes show all moore machines as having an output even for q0, the starting state.
This video shows a Moore machine without an output for its starting state.
I understand that all Moore ...
-1
votes
0
answers
17
views
Prove L = { $c^m$ $a^{2k}$ $b^{n+3}$ | m >= 8, n >= k >= 1} is not regular using pumping lemma
I have to prove that L = { $c^m$ $a^{2k}$ $b^{n+3}$ | m >= 8, n >= k >= 1} is not regular using the pumping lemma.
I was thinking that I should take L1 = { $c^m$ $a^{2n}$ $b^{n+3}$ | m >= ...
1
vote
1
answer
81
views
How to formally prove that any regular expression can be written as a finite combination of base cases and operations?
In Michael Sipser's book, "Introduction to the Theory of Computation," regular expressions are defined as follows:
Based on this definition, how can I formally prove that any regular ...
1
vote
1
answer
41
views
Kleene star of any unary language is regular
I want to prove:
Let $L \subseteq \Sigma^*$.
If $\Sigma=\{a\}$, then $L^*$ is regular.
I found this answer:
Kleene star of an infinite unary language always yields a regular language.
But I do not ...
2
votes
1
answer
56
views
Counting words in an unambiguous context-free grammar
Given an unambigious context-free grammar $G = (\Sigma, V, \mathcal R, S)$, is there a polynomial-time algorithm that calculates $|L(G)|$ (including the case where $|L(G)|$ is infinite)?
The rough ...
0
votes
1
answer
60
views
Is the following language decidable?
Please confirm if my understanding of the below question, and my answer is correct.
Is the following language decidable? Justify your answer.
$L = \{\langle M_1,M_2\rangle \mid L(M_1) \cup L(M_2) = \...
0
votes
0
answers
20
views
Derivation for BNF
Given a grammar for something like: h(x) or function(x)
...
0
votes
2
answers
50
views
Help regarding a proof in which i am able to prove a regular language $(a(a+b)*)$ as irregular using pumping lemma
I have a regular language $a(a+b)^*$ to which i applied pumping lemma.
Let the pumping length be $'p'$
and the example string be $$w=a(a+b)^{p-1}$$.
The string satisfies the condition that it is at ...
0
votes
0
answers
44
views
transforming a grammar from EBNF to LL(2)
I have a grammar in EBNF and want to transform it into an LL(2) grammar. Should I omit A -> empty string ? And is there a scheme I can follow? So far I would ...