Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please advise if my answers to the question below are correct. If they are not please let me know the correct answer and the explanation.
Please advise if my answers to the question below are correct. If they are not please let me know the correct answer and the explanation. Thank you!
2017 Question 1 In the programming language Pascal, an identifier is a sequence of Roman letters and Arabic digits. An identifier always starts with a letter. The shortest identifier is a single character Note: Do not unpack or expand the definitions of digit and letter in your answers to (a), (b), (c) and (d) (a) Give a regular expression for Pascal's representation of identifiers, making use o letter and digit as defined below. [5] Ic=(abcdefghijkImnopqrstuvwxyz)uc=(ABCDEFGHIJKLMNOPQRSTUVWXYZ)letter=(Ic|uc)digit=(0|1|2|3|4|5|6|7|8|9) Answer letter+(letter|digit) (b) Translate the regular expression given in your answer to (a) into a Non-deterministic Finite Automaton (NFA), showing your working. [7] Answer| NFA State Transition Table (Working) (c) Translate the Non-deterministic Finite Automaton given in your answer to (b) into a Deterministic Finite Automaton (DFA), showing your working. [8] Answer DFA cannot have dead configuration We will have to create a new state to handle . This is known as the dead state or trap state In a DFA we need to show for a particular input which state it will go (d) Using your answer to part (b) of this question, give a state-transition lookup-table for parsing identifiersStep 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