Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PLEASE USING C++ for this assignment CPSC 3383 HW 2 (I) (). Give an unambiguous grammar for the language of ail positive even integers. (For

PLEASE USING C++ for this assignment image text in transcribed
CPSC 3383 HW 2 (I) (). Give an unambiguous grammar for the language of ail positive even integers. (For example, the string 341134256 is in this language, but the string 43 is not.) (b). Give a syntax diagram for this language. Hint: For both parts (a) and (b), you can proceed "from scratc" or you can build upon the work alreedy done in class on grammars and syntax diagrams for the language of all positive integers. (2). Consider the grammar The terminal symbols here are in small letters, Le, a and b) (a). Precisely what language does this grammar generate? (A succinct answer wil suffice.) (b). Show that this grammar is ambiguous. (c). Find an unambiguous grammar for this language. (d). Give a syntax diagram for this language. (3). (A "difficuk" language!) Consider the grammar: It is easy to see that this grammar is ambiguous, but I do not lnow if there is an unambiguous grammar which generates the same language. Furthermore, precisely describing the language this grammar generates (and proving that the description is correot) requires a detailed mathematical argument (which will be supplied as a hand-out at a later time)l Nevertheloss, it is not difficuit to decide whether or not spectfic strings are in this language; rcall that, to show that a string is in the language, you need merely provide a parse tree or series of production rules for generating it, and, to show that a speaific string is not in the language, it suffices to find some condition that a string MUST satisfy in order for it to be in the language but which the specific string in question fails to meet. In particular, please decide which of the following strings are in this language, and justify your claims! (For convenience, algebraic notation is used below to sborten the description of the strings.) (a). a?bel7dedc7 (c). a'bedc'dc (c). a^be1001de999 CPSC 3383 HW 2 (I) (). Give an unambiguous grammar for the language of ail positive even integers. (For example, the string 341134256 is in this language, but the string 43 is not.) (b). Give a syntax diagram for this language. Hint: For both parts (a) and (b), you can proceed "from scratc" or you can build upon the work alreedy done in class on grammars and syntax diagrams for the language of all positive integers. (2). Consider the grammar The terminal symbols here are in small letters, Le, a and b) (a). Precisely what language does this grammar generate? (A succinct answer wil suffice.) (b). Show that this grammar is ambiguous. (c). Find an unambiguous grammar for this language. (d). Give a syntax diagram for this language. (3). (A "difficuk" language!) Consider the grammar: It is easy to see that this grammar is ambiguous, but I do not lnow if there is an unambiguous grammar which generates the same language. Furthermore, precisely describing the language this grammar generates (and proving that the description is correot) requires a detailed mathematical argument (which will be supplied as a hand-out at a later time)l Nevertheloss, it is not difficuit to decide whether or not spectfic strings are in this language; rcall that, to show that a string is in the language, you need merely provide a parse tree or series of production rules for generating it, and, to show that a speaific string is not in the language, it suffices to find some condition that a string MUST satisfy in order for it to be in the language but which the specific string in question fails to meet. In particular, please decide which of the following strings are in this language, and justify your claims! (For convenience, algebraic notation is used below to sborten the description of the strings.) (a). a?bel7dedc7 (c). a'bedc'dc (c). a^be1001de999

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

Conceptual Database Design An Entity Relationship Approach

Authors: Carol Batini, Stefano Ceri, Shamkant B. Navathe

1st Edition

0805302441, 978-0805302448

More Books

Students also viewed these Databases questions

Question

2. How were various roles filled?

Answered: 1 week ago

Question

2. What process will you put in place to address conflicts?

Answered: 1 week ago