Design an attribute grammar recognizing the language consisting of binary strings containing the same number of 0’s and 1’s. Explain your construction
Design an attribute grammar recognizing the language consisting of binary strings containing the same number of...
Design a non-ambiguous grammar generating the language consisting of all binary strings, which contain an odd number of 0’s and an odd number of 1’s. Justify correctness of your construction.
13.) Write a grammar for the language consisting of strings that have n copies of the letter a followed by one more number of copies of the letter b, where n>0. For example, the strings abb, aaaabbbbb, and aaaaaaaabbbbbbbbb are in the language but a, ab, ba, and aaabb are not. Answer the aaaaaabbbbbbbh are in the languagebr 14.) Draw parse trees for the sentences abb and aabbb, as derived from the grammar of Problem 13. Answer:
Write a context-free grammar for the language where all strings are of even length and the first half of the string is all 0’s, but it must be an odd number of 0’s
1. Who are language descriptions intended for? Consider the following grammar: ab b | b a | a Which of the following sentences are in the language generated by this grammar? (DONE) a) baab ==> YES b) bbbab ==> NO c) bbaaaaaS ==> NO d) bbaab ==> YES 2. Write a BNF grammar for the language consisting of binary strings (any combination of 0s and 1s) of at least 2 digits.
Design a regular language where every sentence has to start with any number of strings 101 (any number is none or more), then repeats 00 any number of times, then repeats 01 at least once. Use regular expression notation. Clarification: alphabet is {0,1}. 'string' is the same as program, but here the programs are written using binary alphabet in a silly language.
Construct NFAs for the following languages: 1. The set if binary strings such that the number of 0's is a multiple of 3 or the number of 1's is a multiple of 5. 2. The set of all binary strings containing 101 or 100 as substring 3. The set of all strings such that the 12th symbol from the right end is 0
Consider the set of all strings consisting of one or more “a”s. Explain the flaw in this grammar and if possible, give an example string this grammar produces that is not in the set: <S>* ::= <T> | a <T> ::= a <T> | <empty> language is SML/NJ
DO NUMBER 4 AND 5
2. Let {acgt} and let L be the language of strings consisting of repeated copies of the pairs at, ta, cg, gc. Construct both a DFSM to accept the language and a regular expression that represents the language 3. Let a,b. For a string w E X", let W denote the string w with the a's and b's flipped. For example, for w aabbab: w bbaaba wR babbaa abaabb {wwR Construct a PDA to accept...
Homework. Section 5.1 #m}. Hint: Think of this language 1. Design a context-free grammar for the language {a" b n as the union of {a"b" | n > m} and {a") n<m}. 2. Consider the context-free grammar G = (N,T, P, S), defined by N = {S}, T = {a,b), and P = {S + Sbs | bSaS | }. Find derivations, and corresponding parse trees, for the following strings: aaabbb, bbbaaa, ababab. What is L(G)?
DO NUMBER 3
2. Let {acgt} and let L be the language of strings consisting of repeated copies of the pairs at, ta, cg, gc. Construct both a DFSM to accept the language and a regular expression that represents the language 3. Let a,b. For a string w E X", let W denote the string w with the a's and b's flipped. For example, for w aabbab: w bbaaba wR babbaa abaabb {wwR Construct a PDA to accept the language:...