Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

QUESTION 4: A: Consider syntax of Switch-Case statement of JAVA programming language and create an equivalent L-attributed SDD for chosen grammar. B: Consider an unambiguous

QUESTION 4: A: Consider syntax of Switch-Case statement of JAVA programming language and create an equivalent L-attributed SDD for chosen grammar. B: Consider an unambiguous expression grammar that accepts parenthesis, +, , , and unary minus (-) operators; Create SDD that generates directed acyclic graph (DAG) or syntax tree. C: Consider the grammar in PART (B) and rewrite SDD to generate Three-Address Code that accepts the following input string: x = a + b c ( d e ) D: Consider the following Semantic rules:

image text in transcribed Now translate the following assignments:

i) y = a [ i ] [ j ] + b [ c [ k ] ] [ j ]

ii) y = c [ k ] + b [ a [ c [ i ] ] + 2 ]

YOU HAVE TO SOLVE ONLY PAR D

YOU HAVE TO SOLVE ONLY PAR D

YOU HAVE TO SOLVE ONLY PAR D

I WILL UPVOTE IF THE ANSWER IS CORRECT

D: Consider the following Semantic rules: S + id = E; {gen( top.get(id.lexeme) '=' E.addr); } | L=E; { gen(L.array.base 'l' L.addr '''=' E.addr); } E + E + E { E.addr = new Temp(); gen(E.addr'=' El addr'+ Ey addr); } id { E.addr = top.get(id.lereme); } IL { E.addr = new Temp(); gen(E.addr '=' Larray.base 'l Laddr '1'); } + id [E] {L.array = top.get(id. lexemne); L.type = L.array.type.elem; L.addr = new Temp(); gen(L.addr'=' E.addr'*' L.type. width); } | L[E] {L.array = L aray; L.type = Lj.type.elem; t = new Temp 0); L.addr = = new Temp(); gen(t'= E.addr 's' L.type.width); gen(L.addr'=' Laddr'+'t); } - . . : . D: Consider the following Semantic rules: S + id = E; {gen( top.get(id.lexeme) '=' E.addr); } | L=E; { gen(L.array.base 'l' L.addr '''=' E.addr); } E + E + E { E.addr = new Temp(); gen(E.addr'=' El addr'+ Ey addr); } id { E.addr = top.get(id.lereme); } IL { E.addr = new Temp(); gen(E.addr '=' Larray.base 'l Laddr '1'); } + id [E] {L.array = top.get(id. lexemne); L.type = L.array.type.elem; L.addr = new Temp(); gen(L.addr'=' E.addr'*' L.type. width); } | L[E] {L.array = L aray; L.type = Lj.type.elem; t = new Temp 0); L.addr = = new Temp(); gen(t'= E.addr 's' L.type.width); gen(L.addr'=' Laddr'+'t); }

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

Database Processing Fundamentals, Design, and Implementation

Authors: David M. Kroenke, David J. Auer

14th edition

133876705, 9781292107639, 1292107634, 978-0133876703

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago