Question: Certain assemblers form their integer literals in the following way. Binary literals consist of one or more binary digits (0, 1) followed by the letter
Certain assemblers form their integer literals in the following way. Binary literals consist of one or more binary digits (0, 1) followed by the letter B; e.g., 10110B. Octal literals consist of one or more octal digits (0 through 7) followed by the letter Q (since O looks too much like 0); e.g., 1234567Q. Hexadecimal literals consist of at least one decimal digit (0 through 9), followed by zero or more hexadecimal digits(0 through 9 and A through F) followed by the letter H; e.g., 0ABCDEFH.Decimal literals consist of at least one decimal digit optionally followed by the letter D; e.g., 1234. (a) Draw the state diagram o fan NFA (not a DFA) for these literal forms; you may use -transitions, you dont need to use Thompsons construction.
(b) Give a regular expression for the literals; you may use .
(c) Modula-3 based literals have the form base digits (e.g., 2_11111111, 8_377, 16_FF, 255 are equivalent integer literals). Why is the Modula3 form preferable to the assembler form introduced here, from the standpoint of a compiler (or assembler) writer?
Step by Step Solution
There are 3 Steps involved in it
This question is complete Lets address it step by step a Drawing the State Diagram of an NFA To create a state diagram for the given assembler integer ... View full answer
Get step-by-step solutions from verified subject matter experts
