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>
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
4. Construct a grammar over {a, b} whose language is {a"b"|0sn<m<3n}.
) 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}.
Show that this grammar is ambiguous for the string a+b+c: <S> - <x> <X> - <x>+ <x> <X> - <id> <id> - abc Give the derivations.
With Proper explanation and example. Construct a context-free grammar for the language L={ ab”ab”a | n> 1}.
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}.
Question 9 (10 points) Consider the following EBNF grammar for a "Calculator Language": <calculation> <expr> = <expr> > <term> (+1-) <expr> <term <term> <factor> (* ) <term> <factor> <factor> > (<expr>) value> <value> → [<sign> ] <unsigned [. <unsigned> ] <unsigned> <digit> { <digit> } <digit → 011121314151617189 <sign → + - which of the following sentences is in the language generated by this grammar? Whx.2 a. 3/+2.5 = b. 5- *3/4= c. (3/-2) + 3 = d. 5++3 =