

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.
1)a)answer)
Language accepted by this grammar is L={ancmakbkdmbn |n>=0,m>=1,k>=1}
b)answer)
S->aSb
->aaSbb
->aaXbb
->aacYdbb
-->aacabdbb
C)ANSWER)

1. a. What language is generated by the CFG above? b. Derive the string ???????? using...
To verify that a string of characters belongs to a language defined by a grammar, we must create a parse tree that shows that the string can be generated by the grammar. Consider the following grammar: <list> -> <item> , <list> | <item> <item> -> <left> <item> <right> | <left> <right> <left> -> A| B | C <right> -> x | y | z Choose a string that is in this language and create a parse tree that demonstrates that...
Question Set 2 1. Given the following grammar dactor>-> ( <expr> ) a) What is the associativity of each of the operators? What is precedence of the operators? Show a leftmost derivation and parse tree for the following sentence: b) c) A-A(B(C A)) d) Rewrite the BNF grammar above to give precedence over and force to be right associative.
Question Set 2 1. Given the following grammar dactor>-> ( <expr> ) a) What is the associativity of each of the operators? What is precedence of the operators? Show a leftmost derivation and parse tree for the following sentence: b) c) A-A(B(C A)) d) Rewrite the BNF grammar above to give precedence over and force to be right associative.
Given the following ambiguous context free grammar (3x20) 1. (a) Explain why the grammar is ambiguous (b) Find an equivalent unambiguous context-free grammar. (c) Give the unique leftmost derivation and derivation tree for the string s generated from the unambiguous grammar above. 2. Construct non-deterministic pushdown automata to accept the following language (20) 3. Convert the following CFG into an cquivalent CFG in Chomsky Normal Form (CNF) (20)-
1. Consider the following grammar A - aB B-Sb (a) Show a derivation tree for the string aabbbb using the grammar. (b) Give an English description of the language generated by the grammar 2. Let G be the grammar below: S-ASB ab | SS (a) Show that G is ambiguous. (b) Construct an unambiguous grammar equivalent to G. 3. Find a context free grammar for the language L3- fa"b"c+m :n,m21) 4. Find a context free grammar for the language L4...
can you plzz do question 1 and 2
Question 1. Design a CFG for the language over = {1, #} whose elements consist of every pair of distinct, #-separated unary values: L = {rı#x2 | 21, 22 € 1", 21 * x2}. Question 2. Design a CFG for the language of binary strings that contain at least one 1 in their second half: L = {uv | UE (OU 1)", v € OU 1)*1(0U 1)", [u '}. Question 3. This...
1. Which of the following statements is true? A. When an input string is being applied with a set of grammar rules, there is one of derivation. B. Based on a different parse tree, an input string may end up with several different derivations if no precedence or associativity rules are applied. C. Parse tree is done in the lexical analysis stage. D. Grammar design is very forgiving. You may write in whatever style you wish. 2. Modern computers are...
3 points) Question Three Consider the context-free grammar S >SS+1 SS 1a and the string aa Give a leftmost derivation for the string. 3 points) (4 poiots) (5 points) (3 points) sECTION IWOLAttcmpt.any 3.(or 2) questions from this.scction Suppose we have two tokens: (1) the keyword if, and (2) id-entifiers, which are strings of letters other than if. Show the DFA for these tokens. Give a nightmost derivation for the string. Give a parse tree for the string i) Is...
5. What are the language design goals? 6. What are the two main language implementation methods? 7. Name four fundamental programming paradigms? 8. Using the Integer grammar (pg. 27), develop a rightmost derivation for the integer 4520. 9. Using the following grammar: Expr -> Term + Expr | Term * Expr | Term Term -> 0| ... | 9 | ( Expr ) draw a parse tree for each of the following (a) 5 + 4 * 3 (b) 5...
1. Construct a DFSM to accept the language: L w E ab): w contains at least 3 as and no more than 3 bs) 2. Let E (acgt and let L be the language of strings consisting of repeated copies of the pairs at, ta, cg. ge. Construct both a DFSM to accept the language and a regular expression that represents the language. 3. Let ab. For a string w E , let w denote the string w with the...