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

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

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