Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Consider the following context-free grammar in BNF, where and are non-terminals and +, -, and id are terminals. ::= + (r1) ::= - (r2)

3. Consider the following context-free grammar in BNF, where and are non-terminals and +, -, and id are terminals. ::= + (r1)

::= - (r2)

::= (r3)

::= id (r4)

a. (5 points) Construct parsing steps for the string id + id - id in the grammar and state whether or not the string is a sentence in the language. Solution:

b. (5 points) Draw a parse tree from (a) Solution:

c. (5 points) Prove that the grammar is ambiguous Solution

d. (5 points) Disambiguating the grammar. Solution:

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_2

Step: 3

blur-text-image_3

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