Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following shows an Attribute Grammar. Syntax rule: rightarrow = Semantic rule: .expected_type leftarrow .actual_type Syntax rule: rightarrow [2) + [3] Semantic rule: .actual_type leftarrow

image text in transcribed

The following shows an Attribute Grammar. Syntax rule: rightarrow = Semantic rule: .expected_type leftarrow .actual_type Syntax rule: rightarrow [2) + [3] Semantic rule: .actual_type leftarrow if ( [2].actual_type = int) and ( [3].actual_type = int) then int else real end if Predicate: .actual_type == .expected_type Syntax rule: rightarrow Semantic rule: .actual_type leftarrow .actual_type Predicate: .actual_type = = .expected_type Syntax rule: rightarrow A | B | C Semantic rule: .actual_type leftarrow look-up( .string) The look-up function looks up a given variable name in the symbol table and returns the variables type. Syntax portion of this example AG is: rightarrow = rightarrow A | B | C rightarrow + | rightarrow () | Answer the following questions for the statement B = A + E + C Show the leftmost derivation Draw the parse tree Suppose, B is real_tpe, A and C are int_type, decorate the parse tree

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 Systems Design Implementation And Management

Authors: Peter Robb,Carlos Coronel

5th Edition

061906269X, 9780619062699

More Books

Students also viewed these Databases questions