{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

q12-grammar - Consider the ±ve state machine de±ned by...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
CSE 260 QUIZ-12– Grammars and FAs- ANSWERS (20 minutes) NAME: 1. (15 points) Consider the following grammar G = ( V, T, S, P ), where V = { S, a, b } , T = { a, b } and the set of productions P consists of S aS S b (a) Give a derivation for the word aab. S aS aaS aab (b) Give the derivation (parse) tree for the above word. S a S S a b (c) Give the language generated by the above grammar. In set notaion: { a i b | i = 0 , 1 , 2 , ... } Regular expression: a * b 2. (20 points) Let V = { S, A, B, a, b } and T = { a, b } . Find the language generated by the grammar ( V, T, S, P ) when the set of productions P consists of (a) S AB, A ab, B bb { abbb } (b) S AA, S b, A aaA, A aa L = { b, a 2 i +4 | i = 0 , 1 , 2 , ... } 3. (20 points) This exercise covers finite state machines with output. Consider the five
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Consider the ±ve state machine de±ned by the table below. The start state is s . f g input input state 0 1 0 1 s s 1 s 1 0 s 1 s 1 s 2 1 1 s 2 s s 4 0 0 s 3 s 2 s 0 0 s 4 s 3 s 4 0 0 (a) Draw the state diagram (graph) representing this machine. s0 s1 s2 s3 s4 0/0 1/0 0/0 1/0 0/0 1/1 0/1 1/0 0/1 1/0 (b) What is the output string generated when the input string is 001101? 111000 (c) What is the sequence of states through which the machine passes when the input string is 001101? s s 1 s 1 s 2 s 4 s 3 s (d) What is the output string generated when the input string is 1101? 0011...
View Full Document

{[ snackBarMessage ]}