Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. (5 points) We have the following grammar with the start symbol -> -> | + I - 0 | 1 | 2 | 3

image text in transcribed
1. (5 points) We have the following grammar with the start symbol -> -> | + I - 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 (a) Show a leftmost derivation for the expression "7+ 4- 5'; show every step. (b) Show a right most derivation for the above expression; show every step. (c) Show two different parse trees for the above expression d) The grammar is ambiguous. Show a new grammar that removes the ambiguity and makes "+" and "-" left-associative. Show the parse tree for "7 + 4 - 5" in your new grammar. Argue why this is the only parse tree in the new grammar. (e) Show a new grammar that removes the ambiguity and makes "+" and "_" right-associative. Show the parse tree for "7 + 4 - 5" in the new grammar

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

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions