Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Auditing Business Continuity Global Best Practices

Authors: Rolf Von Roessing

1st Edition

1931332150, 978-1931332156

More Books

Students also viewed these Accounting questions

Question

What are the challenges associated with tunneling in urban areas?

Answered: 1 week ago

Question

What are the main differences between rigid and flexible pavements?

Answered: 1 week ago

Question

What is the purpose of a retaining wall, and how is it designed?

Answered: 1 week ago

Question

How do you determine the load-bearing capacity of a soil?

Answered: 1 week ago

Question

what is Edward Lemieux effect / Anomeric effect ?

Answered: 1 week ago

Question

1. Define mass and mediated communication

Answered: 1 week ago