let g be the phrase-structure grammar with vocabulary V = {A, B, a, b, S}, terminal element set T = {a,b}, start symbol S, and productio set P= { S → ABa, S→ Ba, A→aB, AB→b, B→ab}. which of these are derivable from A?
S -> ABa
-> aBBa (using A -> aB)
-> aababa (using B -> ab)
S -> ABa
-> ba (using AB -> b)
S -> Ba
-> aba (using B -> ab)
So, answers are (1), (4) & (5)
Q2. Find a production of the form "A → , such that S → 0A, A → "produces (00) Q3. Let G be the phrase-structure grammar with vocabulary V (A,B, a, b, S], terminal element set T-(a, b), start symbol S, and production set P-(S → ABa, S → Ba, A → aB, AB → b, B → ab). Which of these are derivable from ABa? (1) ba, (2) abb, (3) aba, (4) b, (5) aababa Q2. Find a production...
Automata and Computability Problems Please check my work. Make necessary edits/corrections to my work. Please add more detail to number 2 for better understanding :) 1. Give a context-free grammar (CFG) for each of the following languages over the alphabet = (a, b): (a) All nonempty strings that start and end with the same symbol. 2. Answer each part for the following context-free grammar. I. II. III. IV. V. R> XRXS S -ать | bТа T → XTX | X...
Automata: solve a - e 2. (10+10+10+10+10-50 points) Agrammar is a 4-tuple G, G-ON,E,11,L$) where N is a finite set of nonterminal symbols Σ is a finite set of terminal symbols is a finite set of rules S is the starting symbol Let N- (S, T s-{a, b, c} s-> ab aT >aaTb aT-ac S is the starting symbol. (a 10 points) Prove that the given grammar G is a context sensitive grammar. (b-10 points) What is the language L-...
Write a context-free grammar that generates the same language as regular expression which is ab*|c+ (Describe the four components of context-free grammar which are start symbol(S), non-terminals(NT), terminals(T), and set of production rules(P))
Given the following non-deterministic finite state machine: (c) a σ0 o1 σ2 b Find the input set V, the accepting states set T, the states set S, and initial (i) state for the machine. (10/100) Write the transition table for the machine (ii) (10/100) (iii) Write the simplest phrase structure grammar, G=(V,T,S,P), for the machine (10/100) Rewrite the grammar you found in question 4(c)(iii) in BNF notation (iv) (10/100) (v) Is the string aabaaba an accepted string by the finite-state...
Given the finite state machine: (c) 0,0 1,1 So Start S1 1,1 0,0 0,0 1,0 S2 S3 0,0 (i) Determine the transition table associated with the given state machine above (10/100) (ii) Write the simplest phrase structure grammar, G=(V,T,S,P), for the machine in 4(c)(i) (10/100) (iii Rewrite the grammar you found in 4(c)(ii) in BNF notation. (10/100) (iv) Determine the output for input string 1111, of the finite state machine in 4(c)i) (10/100) Given the finite state machine: (c) 0,0...
help 3. Answer each part for the following CFG G (The * symbom in the derivation means with any number of steps): R + XRXS S + aTb | b Ta T→ XTX | x | 6 X + ab (a) What are the variables of G? (b) What are the terminals of G? (c) Which is the start variable of G? (d) Give three strings in L(G) (e) Give three strings not in L(G) (f) True or False: T...
Please use Python def findSubstrings(s): # Write your code here Consider a string, s = "abc". An alphabetically-ordered sequence of substrings of s would be {"a", "ab", "abc", "b", "bc", "c"}. If the sequence is reduced to only those substrings that start with a vowel and end with a consonant, the result is {"ab", "abc"}. The alphabetically first element in this reduced list is "ab", and the alphabetically last element is "abc". As a reminder: • Vowels: a, e, i,...
6. (20) Let G = (V, ∑, R, S) be a grammar with V = {Q, R, T}; ∑ = {q, r,ts}; and the set of rules: S→Q Q→q | RqT R→r | rT | QQr T→t | S| tT a. (5) Convert G to a PDA using the method we described. b. (15) Convert G to Chomsky normal form. 6. (20) Let G = (V, , R, S) be a grammar with V = {Q, R, T}; { =...
Theory of Computation 7. Write down the Chomsky Normal Form for the context-free language de- fined by the productions: S bAļaB. A bAA laSla, and B aBB bS b, where S, A, B are nonterminal symbols and a, b are terminal symbol 8. For the context-free grammar Ģ -(X, T, R, S) with X (A, B. C, a, b), T a, b and productions R: SAB |BC, ABAa, BCClb,C AB la, check by applying the CYK Theorem whether the string...