Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 6 ( 44=16 points) These questions are slightly tougher and may require to think deeply. Please attend office hours- we are here to help!

image text in transcribed

Question 6 ( 44=16 points) These questions are slightly tougher and may require to think deeply. Please attend office hours- we are here to help! 1. Consider the language consisting of strings that represent the list of numbers separated by commas. For instance, the string "10, 7 " and " 1,7,5,13 " are in the language; also included in the language are lists of a single number (e.g., "12"). Write an unambiguous BNF grammar for the language. Briey explain why your grammar is unambiguous. 2. S>aSaSbb Is this grammar ambiguous? Why? Can we remove its ambiguity if it is ambiguous (provide a replacement grammar)? 3. The following grammar for arithmetic expressions allows addition, subtraction, as well as a unary operator " " for negation; that is, " 8 " is interpreted as the number negative eight. ede+eeee 0123456789 The grammar is clearly ambiguous. Change the grammar so that "+"and "-" are left-associative and the precedence of " " is higher than " + " and "-". 4. Do context-free grammars represent all regular languages? And do regular languages translate all grammars? Are there any languages CFGs may not be able to represent? (Explain each answer in 10 words) (23=6pt)

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

More Books

Students also viewed these Databases questions

Question

Who signs change orders?

Answered: 1 week ago

Question

What is compound interest?

Answered: 1 week ago

Question

7. What decisions would you make as the city manager?

Answered: 1 week ago

Question

8. How would you explain your decisions to the city council?

Answered: 1 week ago