2. Draw a DFSA for identifiers that contain only letters and digits, where the i
ID: 3625132 • Letter: 2
Question
2. Draw a DFSA for identifiers that contain only letters and digits, where the identifier must have at least one letter, but it need not be the first character. Hint: everything to the left of the leftmost letter must be a digit.3. Show the moves made using the DFSA for identifiers given in Section 3.2.2. in accepting the following:
1. a
2. a2
3. a2i
4. abc
4. For C-style / * . . . * / comments, give
1. a right regular grammar
2. a regular expression
3. a DFSA
5. Can a language have no reserved words? That is, suppose every reserved word (such as if and for) were merely predefined identifier, which the programmer is free to redefine. Can such a language exist? Explain.
Explanation / Answer
Regular grammars have productions of the following forms: A -> aA -> Ba or A -> aB Identifiers: A letter followed by a sequence of zero or more letters and digits. Identifier -> [a | ... | z] identifier Identifier -> [a | ... | z] [[0*] | [a |
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.