# Assignment 2

- This question refers to the definition of integer literals in Java. What are valid integer literals?
- 123
- 123L
- 0123
- 00123
- 0x123
- 123x

- Write a regular expression for each of the following languages over {a,b}:
- String of a's and b's that begin with a and end with b.
- Strings that have at least two a's.
- Strings that have an even number of a's.
- Strings that do not have two a's in a row.
- Strings that do not end with the substring ab.

- Strings in C are delimited by double quotes ("), and may not
contain newline characters. They may contain double quote or backslash
characters if and only if those characters are "escaped" by a preceding
backslash. Write a regular definition for strings in C.

- Financial quantities in American notation have a leading dollar
sign ($), an optional string of asterisks (*), a string of decimal
digits, and an optional fractional part consisting of a decimal point
(.) and two decimal digits. The string of digits to the left of the
decimal point may consist of a single zero (0). Otherwise it must not
start with a zero. If there are more than three digits to the left of
the decimal point, groups of three (counting from the right) must be
separated by commas (,). Example: $**1,234,567.89.

- Convert the regular expressions of Questions 3 and 4 to DFAs.

- Write a tokenizer for the toy language.