Question

In: Computer Science

Assignment #2 Total 43 pts (12pts) List at least 3 words in the language and write...

Assignment #2

Total 43 pts

  1. (12pts) List at least 3 words in the language and write regular expressions for the following:

  1. S = {a,b,c} L = {all words that have only one letter c in them}

  1. S = {a,b,c} L = {all words in which c’s appear in groups of two}

  1. S = {a,b,c} L = { all words that begin and end with the same letter}

  1. S = {a,b,c} L = { all words that begin and end with a different letter

  1. (5pts) Write a grammar for the language S = {a,b,c} L = {all words that have only one letter c in them}

  1. (5pts) Write a grammar for the language S = {a,b,c} L = {all words where every b is immediately followed by the letter c}

  1. (10pts) Using the grammar below show a leftmost derivation

for A = B * (C + A)

<assign> à<id> = <expr>

<id> à A | B|C

<expr>à <expr> + <term>

                | <term>

<term> à <term> * <factor>

    |<factor>

<factor> à ( <expr> )

               |<id>

  1. (5pts) Given the following grammar

Sà aScB | A | b

Aà cA | c

             Bà d | A

   Show a rightmost derivation for: acccc

  1. (6pts) Is the following grammar ambiguous? Explain your answer.

SàAB | BA

Aà AA | b

B à Bb | a

Solutions

Expert Solution


Related Solutions

The language is C++. 1. (4 pts) What is a constructor? Explain. 2. (3 pts) What...
The language is C++. 1. (4 pts) What is a constructor? Explain. 2. (3 pts) What is a class? Explain. 3. (3 pts) In your own words, what is a function overloading?
Programming assignment (100 pts): In the C++ programming language write a program capable of playing Tic-Tac-Toe...
Programming assignment (100 pts): In the C++ programming language write a program capable of playing Tic-Tac-Toe against the user. Your program should use OOP concepts in its design. You can use ASCII art to generate and display the 3x3 playing board. The program should randomly decide who goes first computer or user. Your program should know and inform the user if an illegal move was made (cell already occupied). The program should also announce if one of the players wins...
Question 3, and 4 2.(50 pts) For the following list of nuclides, complete the following: List...
Question 3, and 4 2.(50 pts) For the following list of nuclides, complete the following: List the number of protons Hydrogen-1= 1 Iron-56 =26 Zirconium-91= 40 Gold-197 =79 Uranium-238: 92 List the number of neutrons Hydrogen-1 = 0 Iron-56 = 30 Zirconium-91 = 51 Gold-197 = 118 Uranium-238: 146 Write out the nuclide in the form   Hydrogen-1 = 1 H 1 Iron-56 = 56 Fe 26 Zirconium-91 = 91 Zr 40 Gold-197 = 197 Au 79 Uranium-238 = 238 U...
For this assignment, you are to write a 3-5 page paper (At least an outline) What...
For this assignment, you are to write a 3-5 page paper (At least an outline) What ethical issues are often faced in long-term care, and how are they resolved? Include examples.
For this assignment, you will write a 2–3-page paper (double-spaced, 1-inch margins) providing at least 1...
For this assignment, you will write a 2–3-page paper (double-spaced, 1-inch margins) providing at least 1 example of how government has overstepped biblical principles in some form of economic policy.
(10 pts) Draw the result of hashing 11, 22, 3, and 43 into a table using...
(10 pts) Draw the result of hashing 11, 22, 3, and 43 into a table using the following hash function, using separate chaining: h(x) = x % 4                0 1 2 3 (10 pts) Draw the result of hashing 11, 22, 3, and 43 into a table using the following hash function, using open addressing with linear probing: h(x) = x % 4 0 1 2 3
For Paper #2, write a 1-2 page (at least 300 words) reflection on: What was the...
For Paper #2, write a 1-2 page (at least 300 words) reflection on: What was the process that you used in writing your argumentative focus assignment? How did that process work for you? How did the revision process go for you? What did you revise? What were your goals for writing and understanding this project? Do you feel you met those goals? If you had additional time to work on this project, what else would you do?
1. For each item, write what is required using only English words. (a) (2 Pts.) The...
1. For each item, write what is required using only English words. (a) (2 Pts.) The converse, contrapositive, inverse and negation of \If George feels well, then George is is going to a movie or going dancing". (b) (2 Pts.) The converse, contrapositive, inverse and negation of \Anna is failing history and psychology, then Anna is not graduating". (c) (2 Pts.) The statement represented by the symbols below and the negation of such statement: 8s9c (M(s) ! (D(c) ^ T(s;...
List and explain at least three components of quality health care. Write 250 words please
List and explain at least three components of quality health care. Write 250 words please
ACC 926 Assignment #1 (Chapter 2)        Select among the list of words the one that best...
ACC 926 Assignment #1 (Chapter 2)        Select among the list of words the one that best justifies the following accounting procedures.  A term may be used more than once, or not at all.  Choose the best answer. a. Historical cost f. Economic Entity l. Full disclosure g. Materiality m. Comparability b. Relevance h. Fair Value c. Monetary unit i. Periodicity n. Representational Faithfulness Timeliness d. Going concern j. Matching o. e. Control k. Revenue Recognition _____   1.  Recording significant subsequent events in the Notes...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT