Consider the following CFG
S ? aB S ? bA
B ? b A ? a
B ? bS A ? aS
B ? aBB A ? bAA
Consider the following derivation
S ? aB
? aaBB
? aaBb
? aabSb
? aabbAb
? aabbab
This derivation is
a. a leftmost derivation
b. a rightmost derivation
c. both leftmost and rightmost derivation
d. neither leftmost nor rightmost derivation
We need at least 10 more requests to produce the answer.
0 / 10 have requested this problem solution
The more requests, the faster the answer.
please answer 17c and 17d. 17. Show that the following Post correspondence systems have no solutions. a) [b, ba], [aa, b], [bab, aa], [ab, ba] b) [ab, a]. [ba, bab], [b, aa], [ba, ab] c)lab, aba] lbaa, aa]. [aba. baal (dy [ab, bb], [aa, ba]. [ab, abb]. [bb, bab] e) [abb, ab], [aba, ba], [aab, abab] 17. Show that the following Post correspondence systems have no solutions. a) [b, ba], [aa, b], [bab, aa], [ab, ba] b) [ab, a]. [ba,...
Create a CFG for the following expressions: 6. a) ab(a+b)*ba (10) b) a*ba* (10) c) Convert the previous CFGs into Chomsky's normal form, CNF (20) d) Draw the syntax tree for one word from each of the previous CFGs. (10) Create a CFG for the following expressions: 6. a) ab(a+b)*ba (10) b) a*ba* (10) c) Convert the previous CFGs into Chomsky's normal form, CNF (20) d) Draw the syntax tree for one word from each of the previous CFGs. (10)
Consider the following grammar: A -> aB | b | cBB B -> aB | bA | aBb C -> aaA | b | caB Perform the pairwise disjoint test for the grammar. Rewrite the above grammar so that all grammar rules pass the pairwise disjoint test. Suppose lex() is the lexical analyzer which gets the next lexeme and puts its token code in the global variable nextToken. And suppose the token codes for terminals a, b, and c are...
lIhg derivation in tion for each of the following Post correspondence systems. 16, Find a solution for each la, aaa), taab, b), [abaa, ab la, abl. tba, aba), lb, aba), [bba, b] 17 Show that the following Post coespondence systems have no solutions a) [b, ba], [aa, bl, [bab, aa], [ab, ba] by [ab, al, [ba, bab], [b, aa], [ba, ab] c) [ab, aba], [baa, aa], [aba, baa] lab, bb], laa, ba), lab, abbl, [bb, bab] e) [abb, ab], [aba,...
Eliminate all useless rules from the following CFG: S → abS | abA | abB A→ cd B→ aB C → dc
1. a. What language is generated by the CFG above? b. Derive the string ???????? using the grammar in part a. c. Draw the derivation tree for the derivation in part b. Derivation tree, operator precedence, operator associativity, left recursion, right recursion, prefix notation, postfix notation S→ Sbx X+ cxdcYd YaYb ab
Please actually answer it For both of the following languages, provide a grammar that generates it, an intuitive explanation why this grammar generates this language, and a graphical representation of a push-down automaton that recognizes this language. (a) The language of properly nested sets of parentheses over the alphabet G)). Note that the string (COO))) belongs to this language, while the string (O) () does not because the third closing parenthesis does not have a matching opening parenthesis. Provide a...
Consider the following context-free grammar with terminals {a, b, c, d} and start symbol S. S → W | X | Y | Z W → AW D | X | Y | Z X → BXD | Z Y → AY C | Z Z → BZC | ε A → a B → b C → c D → d (a) Give a derivation tree with input string: aaaabccddd (b) What language does this CFG recognize? Give a...
Problem 1. Consider the grammar S → Y X Y X → a Y | Y Y → b b Y | X | ε where a and b are tokens. Remember that ε represents the empty string. Y → ε means that Y does not have to match any tokens. 1. Give a leftmost derivation for the string (sequence of tokens): bbabbabb 2. Give a rightmost derivation for the string (sequence of tokens): bbabbabb
For the following grammar (7 points) 1. B - Ba|A S - ABb A - Aba |A to find a grammar without A productions that generates the same language, we first identify non-terminals that drive A. These non-terminals are: A and B. Then from S - ABb, we construct S from A - Aba, we construct A - from B - Ba, we construct B - So, the grammar without A that generates the same language is: