Modify The Attribute Grammar Of Example 3 6 In Sebesta So That It Uses Only A Si

Modify the attribute grammar of Example 3.6 in Sebesta so that it uses only a single (synthesized) attribute.Ex 3.6:An Attribute Grammar for Simple Assignment StatementsSyntax rule: → = Semantic rule: .expected_type ← .actual_typeSyntax rule: → [2] + [3] Semantic rule: .actual_type ←Predicate:if ([2].actual_type = int) and ([3].actual_type = int)then int else realend if.actual_type == .expected_typeSyntax rule: → Semantic rule: .actual_type ← .actual_type Predicate: .actual_type == .expected_typeSyntax rule: →A | B | CSemantic rule: .actual_type ← look-up(.string)The look-up function looks up a given variable name in the symbol table and returns the variable’s type.

Leave a Reply

Your email address will not be published. Required fields are marked *