What is a regular language?

I’m trying to understand the concept of languages levels (regular, context free, context sensitive, etc.). I can look this up easily, but all explanations I find are a load of symbols and talk about sets. I have two questions: Can you describe in words what a regular language is, and how the languages differ? Where … Read more

Why can’t C++ be parsed with a LR(1) parser?

I was reading about parsers and parser generators and found this statement in wikipedia’s LR parsing -page: Many programming languages can be parsed using some variation of an LR parser. One notable exception is C++. Why is it so? What particular property of C++ causes it to be impossible to parse with LR parsers? Using … Read more

What is the difference between the input set of a BSS RAM and a language?

I’m currently learning some things about BSS RAMs. For sake of simplicity, please imagine them as a Turing machine over the reals. Now, this machine gets some real numbers as input. The input values form nearly a string, but are not of finite length as decimal representation. Additionally, there are infinitely many real numbers. A … Read more

Is the set of context free grammars that generate all words in co-RE?

Is {⟨G⟩|L(G)=∑⋆} in co-RE? ⟨G⟩ is the encoding of a context free grammar. My intuition is that this is false. Answer For A={⟨G⟩∣L(G)≠Σ∗} this procedure, returns “yes” iff there is a word w∉L(G) for a given grammar encoding ⟨G⟩ and never halts otherwise: Assume the input encodes a context-free grammar G. Otherwise, accept the input … Read more

Need help understanding what co-recursively enumerable means

Lets say I have a set: L={⟨G⟩|L(G)=Σ⋆} and the question asks if it is co-RE. I know that if something is co-RE, it halts on every input not in L but may or may not halt on inputs in L. So in this case would something “not in L” be nothing? Answer If you by … Read more

Efficiency/Redundancy in Chomsky normal form

I have a context-free grammar with the following production rules, S being the start symbol: S→ABA→aB→a Is this in Chomsky normal form? My problem is I thought CNF is supposed to be an efficient way to write a grammar, yet the grammar is not efficient in the sense that we can clean its rules as … Read more

Why full Chomsky hierarchy is so detailed, if there are decidable recursive languages?

One can have a look on the Chomsky hierarchy https://en.wikipedia.org/wiki/Chomsky_hierarchy , especially the inset named “Automata theory: formal languages and formal grammars” at the bottom of the page. When one tries to model natural language (e.g. as http://www.grammaticalframework.org/ tries to do it), then one usually aims for the most expressive formal language that is still … Read more

How to create model for a powerful language whose programs are guaranteed to terminate?

I’m creating a powerful regular expression matching system that can be augmented by adding small microprograms to deterministic finite automaton (DFA) states. The microprogram solves the big bang issue where a rule of the form .*ab.*cd doubles the state count of the DFA. The solution for the “big bang” problem is to create a program-augmented-DFA … Read more

Pumping Lemma vs Myhill-Nerode [duplicate]

This question already has answers here: How to prove that a language is not regular? (10 answers) Closed 2 years ago. I was searching for a difference on both ways of proving that a language is not regular but I didn’t came up with much. Let us take the following as an example: L={anbn∣n≥0} Could … Read more

Converting CFG from GNF to CNF

I am working with grammars that need to be in Greibach Normal Form. I want to check whether a grammar recognises a string. In order to perform CYK the grammar would have to be converted into CNF. Is there an established way of carrying out such conversion? Answer You can just apply the usual procedure … Read more