Question: Write an Attribute Grammar(AG) whose base BNF is that of following example and whose type rules are the same as for the assignment statement example

Write an Attribute Grammar(AG) whose base BNF is that of following example and whose type rules are the same as for the assignment statement example of Section 3.4.5.

=

A | B | C

+

| *

| ( )

|

Section 3.4.5 Example:

 Write an Attribute Grammar(AG) whose base BNF is that of following

1. Syntax rule: -> - Semantic rule: .expected type .actual type 2. Syntax rule: -> [2] + [3] Semantic rule: .actual-type if ([2]. actual-type = int) and ([3].actual type -- int) then int else real end if Predicate: .actual-type= .expected.type 3. Syntax rule: 4. Syntax nie: -A | B | C The look-up function looks up a variable name in the symbol table and returns Semantic rule: .actual-type .actual-type Predicate: .actual-type= .expected..type Semantic rule: .actual-type look-up(.string) the variable's type

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!