CFG generating integers
AnswerAssume decimal integers with optional sign and no leading zeros except zero. Use S→N|+N|-N; N→0|DT; D→1|2|3|4|5|6|7|8|9; T→ET|ε; E→0|D. This generates signed and…
Read more →AnswerAssume decimal integers with optional sign and no leading zeros except zero. Use S→N|+N|-N; N→0|DT; D→1|2|3|4|5|6|7|8|9; T→ET|ε; E→0|D. This generates signed and…
Read more →AnswerUse states s,t,u and initial stack Z. δ(s,a,Z)=(t,Z), δ(t,b,Z)=(u,Z), δ(u,a,Z)=(t,Z), δ(u,ε,Z)=(u,ε). No other moves. The machine must read at least one ab…
Read more →AnswerUse states e (even number of a), o (odd), and m (matching b). Start e with Z. On a in e move…
Read more →AnswerG=(V,T,P,S), V={S,X}, T={a,b}, P={S→XaXaX, X→aX|bX|ε}. X generates any string over the alphabet; the two explicit a symbols ensure the required minimum. Conversely…
Read more →AnswerG=({S,A,B},{a,b},P,S), where S→aS|bA|ε, A→aS|bB|ε, B→aS|ε. The variables represent zero, one or two trailing b symbols. No b production exists from B, so…
Read more →AnswerGiven a finite list of pairs of strings (uᵢ,vᵢ), PCP asks whether a nonempty sequence of indices, with repetitions allowed, makes the…
Read more →AnswerThe literal language is {aaaa, abba, baab, bbbb}. Push the first two symbols onto the stack, then match and pop the next…
Read more →AnswerIn a Moore machine output is attached to states. In a Mealy machine it is attached to transitions. For every transition p…
Read more →Answerq0 means no a has occurred, q1 means exactly one, and q2 means at least two. Examples accepted: a, bab, abb. Examples…
Read more →Answerq0 records that no a has occurred; q1 records that an a has occurred. Once q1 is reached it remains accepting. Examples:…
Read more →Ask a study question in English or Hindi. I will find relevant passages from our notes.