Answered step by step
Verified Expert Solution
Question
1 Approved Answer
DFA part I has 100 points and PDA part II has 200 points Note: This problem is designed to show you how DFA and PDA
DFA part I has 100 points and PDA part II has 200 points Note: This problem is designed to show you how DFA and PDA are used in Compilers. DFA is used for finding the tokens (Problem 1) and PDA for syntax (Problem 2 Part I We have the following input file: (for foreign students the name here are of well know comics) larry=27 curly=19 moe = 8 groucho = 11 harpo = larry-curly harpo = larry-curly harpo = larry curly harpo = larry'curly harpo = larry*curly+moe*groucho We need to define a DFA which will give the output various tokens. In this case, the identifiers will be larry, curly, moe groucho, and harpo, The operators will be !, + - + =and integers. They will come as an output file. Here is A DFA for this purpose. (q0 is the starting state, q1. 42 and 43 are accepting states (if it is accepted in state 22. the token is an operator, if it is accepted in ql, the token is an identifier (any string that starts with a letter and then continues with any combination of letters and integer digits. The maximum number of characters for any identifier should be 10.) and q3 if it is an integer (intLit) - you can limit the number of digits to 10). One should write down what strings are accepted (token) and list the names of new_tokens State operator_alpha 90 92 91 91 21 intl.it 93 21 43 alpha int lit operator alpha int lit operator alpha int lit (93 alpha DFA part I has 100 points and PDA part II has 200 points Note: This problem is designed to show you how DFA and PDA are used in Compilers. DFA is used for finding the tokens (Problem 1) and PDA for syntax (Problem 2 Part I We have the following input file: (for foreign students the name here are of well know comics) larry=27 curly=19 moe = 8 groucho = 11 harpo = larry-curly harpo = larry-curly harpo = larry curly harpo = larry'curly harpo = larry*curly+moe*groucho We need to define a DFA which will give the output various tokens. In this case, the identifiers will be larry, curly, moe groucho, and harpo, The operators will be !, + - + =and integers. They will come as an output file. Here is A DFA for this purpose. (q0 is the starting state, q1. 42 and 43 are accepting states (if it is accepted in state 22. the token is an operator, if it is accepted in ql, the token is an identifier (any string that starts with a letter and then continues with any combination of letters and integer digits. The maximum number of characters for any identifier should be 10.) and q3 if it is an integer (intLit) - you can limit the number of digits to 10). One should write down what strings are accepted (token) and list the names of new_tokens State operator_alpha 90 92 91 91 21 intl.it 93 21 43 alpha int lit operator alpha int lit operator alpha int lit (93 alpha
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