{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


cmps104a-2005q4-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 Fall • Test #1 page 1 of 3 $Id: cmps104a-2005q4-exam1.mm,v 359.1 2005-12-07 17:18:08-08 - - $ page 1 page 2 page 3 Please PRINT using keyboard letters : Name : Login : @ucsc.edu Total / 30 Closed book. No notes. No computer. Answer ONLY in the spaces provided. Neatness counts ! Do your scratch work elsewhere and only enter your final answer into the spaces provided. 1. Write flex regexes for each of the following. Do not assume, define, or use any macros. [5 ] i. A string which begins with a quote ( " ) or an apostrophe ( ) and ends with the same character that it begins with, and contains inside of it any number of characters except for the newline ( \n ) character or the kind of character that delimits the string. ii. An identifier which consists of one or more upper- or lower-case letters, digits, and underscores ( _ ) but may not begin with a digit. In addition, an underscore may not be the first character, nor the last, nor appear adjacent to another underscore. iii. A comment in C++ or Java which begins with two slash ( / ) characters followed by zero or more characters up to, but not including a newline ( \n ) character. iv. A string consisting of an odd number of occurrences of the letter x followed by an odd number of occur- rences of the letter y .
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
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}