One example of such sets: Define Q as the set of turing machines, which halt on empty input. Define P as the set of turing machines, which halt on every input. Clearly P ⊂ Q and P is undecidable and not semidecidable, but Q is undecidable and semidecidable....

algorithm,parsing,string-matching,formal-languages,kleene-star

This problem is equivalently stated as: when is L a code over Σ? The standard algorithm for determining this is the Sardinas-Patterson algorithm, published in 1953. There is an interesting discussion in the book review by Juhani Karhumäki (Bulletin of the AMS, vol. 17 no. 1, pp. 161-167, 1987) of...

No, the context-free grammar that defines your language is S -> 0S1 | epsilon You can actually build the tree, for example with the string 000111 S -> 0S1 -> 00S11 -> 000S111 -> 000epsilon111 -> 000111 Be careful with the definitions of grammar and regular expression. The grammar you...

context-free-grammar,formal-languages,context-free-language

For languages with a "not-equal" restriction, the easiest approach is usually to first find a grammar that corresponds to the language with an "equal" restriction instead, and then change it to require more of one of the things. In this case we have a number of a tokens followed by...

javascript,context-free-grammar,formal-languages

No, JavaScript is not a context-free language. It is very close to one, and the ECMAScript 5 specification does indeed use a context-free grammar1 to describe the language's syntax (you can find all productions in Annex A). Of course, it does make some extensions to pure context-free grammatical productions, and...

parsing,compiler-construction,automation,formal-languages,ll

First of all you are finding FIRST and FOLLOW over the grammar in which you have removed left recursion. Therefore surely if you try to create LL(1) parsing table there won't be any 2 entries as left recursion is removed and grammar is unambiguous. Grammar[ S->SA|A A->a ] is not...

The problem is that your grammar is ambiguous. For example 0 NAND 0 NAND 0 has at least two leftmost derivations: A => 0 A' => 0 NAND A A' => 0 NAND 0 A' A' => 0 NAND 0 NAND A A' A' => => 0 NAND 0 NAND...