Question: Design an NFA to recognize the following Python numerical literals and write code to implement your NFA ( or equivalent DFA ) ( i .

Design an NFA to recognize the following Python numerical literals and write code to implement your NFA (or equivalent DFA)(i.e. state transitions, etc.). If you just use a lot of if-else's to check this or that requirement, it's very difficult, if not impossible to prove your program is per spec (the Python Language specification).
You cannot use built-in or 3rd party functionalities that recognize numbers or build/interpret regular expressions, grammar, etc. You need to implement the tasks from scratch.
a)Recognize Python decimal integer literals.For simplicity, you can assume the input strings length <=20. Your program should ask for user input as a string, and check if it can be a valid decimal integer or not. You also need to include your NFA design (with unlimited digits allowed - you can break this into a few smaller NFA parts, so it's not one humongous machine) drawn using JFLAP.
b)Expand your program to recognize Python octal and hexadecimal integer literals. For simplicity, you can assume the input strings length <=20. Your program should ask for user input as a string, and check if it can be a valid decimal/octal/hexadecimal integer or not. You also need to include your NFA design (with unlimited digits allowed - you can break this into a few smaller NFA's so it's not one humongous machine) drawn using JFLAP.
(PLZ INCLUDE THE NFA DIAGRAMS)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!