Below is the pseudocode recursive implementation
isIn(strg){
if(strg=="")return true;
if(strg.charAt(0)=='A' or strg.charAt(0)=='B' or strg.charAt(0)=='-')return isIn(strg.substring(1,end));
return false;
}
Consider the following grammar <word>= empty string<word><dash> |<ch><word><ch> <ch> AB <dash> = - Provide a recursive...
Q3. Convert the following recursive BNF grammar to EBNF: (20%) <assign>-> <id> = <expr> <expr> -> <d>+ <expr> | <id> * <expr> 1 (<expr>) | <i>
4. Construct a grammar over {a, b} whose language is {a"b"|0sn<m<3n}.
QUESTION 22 Using the grammar, <S> <A> <S> + <A> + <A> | <id > <id > → abc which of the following is a word (or sentence) in the language: a + b + c a + b + c + a All of the other answers are words in the language. a + a + a
) Construct a context-free grammar for the language L={ ab”ab”a | n> > 1}.
Construct a context-free grammar for the language L={ ab”ab”a | n> 1}.
With Proper explanation and example.
Construct a context-free grammar for the language L={ ab”ab”a | n> 1}.
Show that this grammar is ambiguous for the string a+b+c: <S> - <x> <X> - <x>+ <x> <X> - <id> <id> - abc Give the derivations.
on 2 Consider the following recursive method test: public static int test(String s, int last) if (last < 0) { return 0; if (s.charAt(last) == 0) { return 2 - test(s, last - 1); return 1 + 2 test(s, last - 1); What is the output of: test("11001", 4). TTT Arial 3 (12pt) - TEE 25
Construct a context-free grammar for the language L={ ab"ab'an> 1}.
Consider the language LOOPS = {<M,w> | M is a Turing machine and M loops forever on input w} Is LOOPS Turing decidable? Explain why or why not. Is LOOPS Turing recognizable? Explain why or why not.