1- Rewrite the productions for each of the following nonterminals as right regul
ID: 3625432 • Letter: 1
Question
1- Rewrite the productions for each of the following nonterminals as right regular grammars: Identifier, Float.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.
6- Show the moves made using the DFSA for identifiers given in Section 3.2.2. in accepting the following:
a
a2
a2i
abc
4- For C-style / * . . . * / comments, give
a right regular grammar
a regular expression
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
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.