cmps104a-2005q1-exam1 - CMPS-104A Compiler Design I 2005...

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

View Full Document Right Arrow Icon
CMPS-104A • Compiler Design I • 2005 Winter • Test #1 page 1 of 3 $Id: cmps104a-2005q1-exam1.mm,v 1.31 2005-07-01 11:21:52-07 - - $ page 1 page 2 page 3 Please PRINT using keyboard letters : Name : Login : @ucsc.edu Total / 30 Closed book. No notes. No computer .Answer ONLYinthe spaces provided. Neatness counts ! Do your scratch work elsewhere and only enter your final answer into the spaces provided. 1. Giventhe following regex: a|bb a. Using Thompson’sconstruction as specified in the Dragon book, convert the regexinto an NFA. Num- ber each state in depth-first order from the initial state. [2 ] b. Drawatable of ε -closures for each state. [2 ] c. Using the subset construction as specified in the Dragon book, convert the NFAinto a DFA. Show which NFAstate belongs to which DFAstate by writing NFAstate numbers inside each DFAstate. Do not minimize. [2 ] 2. Draw deterministic finite αυτοματα for each of the following flex regexes. Use the minimum possible num- ber of states. [4 ] i. ab*c+d ii. a* | b* iii. a+ | bc+ iv. a?(a | b)* 3. A file is balanced with respect to parentheses if for every left parenthesis, there is a corresponding right paren- thesis later in the file, and for every right parenthesis, there is a corresponding left parenthesis earlier in the file.
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/28/2010 for the course CMPS 104A taught by Professor Mackey during the Spring '08 term at University of California, Santa Cruz.

Page1 / 3

cmps104a-2005q1-exam1 - CMPS-104A Compiler Design I 2005...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online