Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2. Consider the following attribute grammar for assignment statement ? .actual-type r>.actual-type : .expected-type PREDICATE : . expected-type- 2 ? [1] [2] + SEMANTIC RULE:

image text in transcribed
image text in transcribed
2. Consider the following attribute grammar for assignment statement ? .actual-type r>.actual-type : .expected-type PREDICATE : . expected-type- 2 ? [1] [2] + SEMANTIC RULE: if ([1].actual-typeint AND [2].actual-typeint) ? ? real int then else .actual-type expr>. actual-type 3 [1] 12] { SEMANTIC RULE: ?f (expr> [1].actual-type -int AND [2].actual-typeint) then else .actual-type .actual-type ? int ? real 4cexpe> ( [1]-) ? { SEMANTIC RULE : , actual-type ? [1].actual-type h ? int-literal { SEMANTIC RULE : . actual-type int } ? real-literal { SEMANTIC RULE : .actual-type ? real } ? { SEMANTIC RULE: .actual-type ?var>.actual-type = } ?var> ? alpha | { SEMANTIC RULE : beta | gamma .actual-type lookupl.string) = } Here, an int-literal is an optional sign + or -) followed by a sequence of digits and a real-literal is an optional sign followed by a sequence of digits followed by a dot followed by another sequence of digits. 2. Consider the following attribute grammar for assignment statement ? .actual-type r>.actual-type : .expected-type PREDICATE : . expected-type- 2 ? [1] [2] + SEMANTIC RULE: if ([1].actual-typeint AND [2].actual-typeint) ? ? real int then else .actual-type expr>. actual-type 3 [1] 12] { SEMANTIC RULE: ?f (expr> [1].actual-type -int AND [2].actual-typeint) then else .actual-type .actual-type ? int ? real 4cexpe> ( [1]-) ? { SEMANTIC RULE : , actual-type ? [1].actual-type h ? int-literal { SEMANTIC RULE : . actual-type int } ? real-literal { SEMANTIC RULE : .actual-type ? real } ? { SEMANTIC RULE: .actual-type ?var>.actual-type = } ?var> ? alpha | { SEMANTIC RULE : beta | gamma .actual-type lookupl.string) = } Here, an int-literal is an optional sign + or -) followed by a sequence of digits and a real-literal is an optional sign followed by a sequence of digits followed by a dot followed by another sequence of digits

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

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

More Books

Students also viewed these Databases questions