Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

7. Design a CFG that generates the arithmetic expressions, with t, -, *, (), a, b, c, together with a new terminal symbol for exponentiation

image text in transcribed
7. Design a CFG that generates the arithmetic expressions, with t, -, *, (), a, b, c, together with a new terminal symbol for exponentiation t. Your grammar should be unambiguous, properly associative. More specifically, it should be left associative for addition +, - and multiplication*, right associative for the exponentiation t. (Recall that, being left associa- tive for addition , an expression such as a +b+c should have the unique arsing as the sum of a + b and c.) It should also have a precedence rule embedded in the grammar that is highest for exponentiation, second high- est for multiplication, and finally for addition/subtraction. With addition and subtraction, whichever is left most gets precedence. For example: for the expression The only valid derivation should parse it as such: First, f t g, then etft g: also, c"d, then cd etftg: also a + b and then a + b- .. (You-don't need to prove all the requirements here are satisfied. But if you correctly prove that all the requirements here are satisfied, you will earn extra credit.)

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

Database Internals A Deep Dive Into How Distributed Data Systems Work

Authors: Alex Petrov

1st Edition

1492040347, 978-1492040347

More Books

Students also viewed these Databases questions

Question

=+ Are unions company-wide, regional, or national?

Answered: 1 week ago