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

  What addressing mode is most appropriate

Suppose n will be the result of an addition instruction and, thus, is not known statically. What addressing mode is most appropriate to use to access the data located in memory at an address that is n bytes larger than the contents of register X?

  Write down the entries in the permuterm index dictionary

Consider these documents: Write down the entries in the permuterm index dictionary that are generated by theterm mama

  Type of connections in elevator shaft

Describe what type of connections would work within the elevator shaft. If more than one choice is possible, choose the best option and describe the reasons for your choice.

  What are the types of new ethernet equipment

An older network using 10baseT technology needs an upgrade. The network contains a total of 220 workstations and 10 servers and has a network diameter of 300 meters. What type of new Ethernet equipment would you suggest be purchase to modernize th..

  Write down a sql statement to show warehouse

Write down a SQL statement to display the SKU and Description of all items stored in the Seattle, Chicago or New Jersey warhouse. Do not use IN.

  Explain most computer memories are composed of a large

Most computer memories are composed of a large number different devices that are interconnected to form the whole memory array which is accessed using the address bus.

  How technology can help your business

Learning the terms, acronyms, and technologies of your business is imperative when trying to understand how technology can help your business

  Define which option you prefer and why

Write down a paper describing the steps involved in publishing a Web site.

  What medium would you recommend and why

GJ Enterprises has hired you as a productivity consultant. What medium would you recommend, and why?

  How cloud technology could align with the company

Create a workflow diagram to illustrate how analytics and cloud technology could align with the company's business processes. Note: The graphically depicted solution is not included in the required page length but must be included in the design docum..

  Do a research systems architecture in healthcare websites

do a research systems architecture in healthcare websites. nbspwrite a 3-5 page paper in apa format. clearly show

  How term "educational technology" covers a wide range

The word "educational technology" covers a wide range of tools and methods exploiting computers, networks and media for delivering knowledge. Compare virtual classes with minimum  two other delivery methods (TV-based courses, on-site company trai..

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