What are the non-terminals and what is the start symbol

Assignment Help Computer Engineering
Reference no: EM131830112

Assignment

Problem 1. Consider the following regular expressions (omitting the dot operator)

Rθ = a | b | c
R1 = a | b | c | d
R2 = (a | b) (a* | b*)
R3 = (a* | b*)R1 (ab) (ab)*
R4 = ab R3* (a | b)*
R5 = R3* aaa R2*

Let getToken() be a function that returns the next token in the input. If we call it repeatedly it will return one token after another. When all the input is consumed, getToken() returns EOF (end of file). Assume that longest prefix-matching rule is used by getToken() and ties are broken in favor of the regular expression listed first.

1. Give an example of input for which getToken() returns Rθ
2. Give an example of input for which getToken() returns R1
3. Give an example of input for which getToken() returns R2
4. Give an example of input for which getToken() returns R3
5. Give an example of input for which getToken() returns R4
6. Give an example of input for which getToken() returns R5
7. If getToken() is called repeatedly on the following input, what is the sequence of tokens and lexemes returned? In your work, show step by step the Matched, Potential (Viable), and Maximal tokens.

aaadbabaadaaadabbbaab

Problem 2. Let R1 and R2 be two regular expressions,

1. Is it alwaysthe case that L(((R1)*)|((R2)*)) = L(((R1)|(R2))*)?
2. Is it alwaysthe case that L(((R1)*).((R2)*)) = L(((R1).(R2))*)?
3. Is it alwaysthe case that L(((R1)*|(R2)*)*) = L(((R1)|(R2))*)?
4. Is it always the case that L((R1*)*) = L((R1)*)?

In each case explain why the statement is true or provide a counter example.

Problem 3. Consider the grammar

S → X Y
X → aX | b
Y → bbY | E

Draw a parse tree for input string aabbb

Problem 4. Consider the grammar

S → X Y
X → YaX | Y b
Y → aXYY | X X Y | E

1. What are the non-terminals?
2. What is the start symbol?
3. What are the terminals?
4. Show that this grammar is ambiguous by constructing two different parse trees for the string abab

Reference no: EM131830112

Questions Cloud

Determine amount of cash provided by investing activities : Old Alabama Company purchased investments for $45,000, Determine the amount of cash provided by or used for investing activities for the year
Least one point that belongs to infinitely many sets an : Show that, if there exists ?>0, such that ?(An) = ? for all n, then there exists at least one point that belongs to infinitely many sets An.
Debt service is twice as much as the operating expenses : Assume a property has a potential gross income that is one tenth of its purchase price. Debt service is twice as much as the operating expenses.
Write an algorithm for the given tasks : Write an algorithm for the following tasks. Examine the solutions in Exercise 4 and determine three things they have in common.
What are the non-terminals and what is the start symbol : What are the non-terminals? What is the start symbol? What are the terminals? Show that this grammar is ambiguous by constructing two different parse trees.
Targeted weighted average cost of capital : What debt-equity ratio is needed for the firm to achieve its targeted weighted average cost of capital?
Compute the direct labor efficiency variance : Snazzy Jeans, Inc. manufactures designer jeans. Compute the direct labor efficiency variance and specify if it is favorable or unfavorable
What is the value of the mean of x : a. What is the value of the mean of X? b. What is the value of the standard deviation of X? c. What is the value of the mean of Y?
What role should the public play in risk management : Write at least 500 words and Include at least 2 APA-cited references. Cite information and add a body of knowledge and relevance.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Discuss now considering expanding internationally

A merged company continues to grow. More stores have been added and Internet sales are growing. The company is now considering expanding internationally

  Explain computer forensic investigation procedures

Explain computer forensic investigation procedures. Evaluate sources of evidence. Analyze laws related computer forensics.

  Show that the order in which catch clauses

Write a program that can be used to show that the order in which catch clauses are listed is important

  Create a document which defines and describes it

Create a document which defines and describes IT. You may use any resource; however, be sure to cite any resources you use

  Class definition for objects that receive notifications

The interface requires that the method be implemented, The class definition for objects that receive notifications of user operations on controls

  Which jobs require specific hardware knowledge

Which jobs require specific hardware knowledge? Which jobs imply knowledge of computer hardware? Is there any correlation between the required hardware knowledge and the company or its location?

  What are advantages and disadvantages of separate address

The 68000 implements negative addresses because the contents of address registers are treated as 2's-complement values. What is a negative address.

  You have been put in a role of the cio chief information

you have been put in a role of the cio chief information officer you may choose the type of facility. looking at the

  How would you begin an interview with a knowledgeable user

Suppose that your goal is to create a set of DFDs. How would you begin an interview with a knowledgeable user? How would you begin a JAD session?

  Questionyou identified use cases and considered domain

questionyou identified use cases and considered domain classes for the state patrol ticket processing system. review

  Calculate the sample estimate for the total amount

Sample Evaluation. Marts Inc., a local fund-raising organization, is considering the feasibility of a fund-raising campaign to assist a youth organization.

  How much time you expect to put into this class

Transferring a Document to Another Computer Time Required: 15 minutes Objective: Create a document and copy it to your instructor's computer.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd