Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started