Description
1. Draw a deterministic finite state machine that accepts the language of file paths.
A file path consists of optional directory names and one file name, separated by “/”.
1. The path must start with “/”
2. A directory name can include letters and digits
3. A file name can include letters, digits and dots
4. A file name cannot have two dots in a row
5. A file name cannot end with a dot
6. CLARIFICATION: Both file name and directory name should contain at least one character
Label the edges of your FSM with words slash, dot, letter and digit.
Valid samples:
/P1.java
/This/is/a/very/long/directory/.file
/foo/I.have.many.dots
/bar/NoDot
2. Write a regular expression for a UsernameTag. A UsernameTag is of the following format :
UserName#Number
1. UserName and number are seperated by “#”
2. UserName can include letters, digits and “-”
3. UserName must start with a letter, and cannot end with “-”
4. UserName cannot have two hyphens in a row
5. Number can only include digits, and should contain at least one digit
Valid samples:
shixuan-fan#35
life4compiler#0102
You may use hyphen to represent “-“, digit to represent any digit and letter to represent any letter.

