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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!