Question: You are developing a new programming language Jaguar and need to decide how integers should be represented. The following is a specification for a Jaguar
You are developing a new programming language Jaguar and need to decide how integers should be represented. The following is a specification for a Jaguar integer that one of your teammates comes up with.
A Jaguar integer can be unambiguously specified in decimal, octal or hexadecimal form. All of these forms can begin with an optional sign, which can be a or a with no separating characters between it and the rest of the integer.
A decimal integer can be a single zero or a sequence of one or more decimal digits that starts with a nonzero decimal digit. The decimal digits are and
An octal number starts with a zero and is followed by a single zero or a nonempty sequence of octal digits that starts with a nonzero octal digit. An octal digit is one of or
A hexadecimal number starts with a zero and is followed by an upper or lower case and either a single zero or a nonzero hexadecimal digit and a sequence of zero or more hexadecimal digits. Hexadecimal digits include the decimal digits and the letters a b c d e and and their uppercase versions.
Notice how long and confusing this description has to be to ensure that it is unambiguous. You can see that we do not allow "leading zeros" in any of the representations, eg is a bad hex number, and is both a bad octal number and a bad decimal number.
a Find the Regular Expression for Jaguar numbers points
Hint: There are several valid options for numbers octal numbers hex numbers decimal numbers
Expand each of these pieces into the regular expression
b Draw the NFA points
c Draw the DFA State Transition Diagram points
d Draw the DFA diagram points
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
