Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Describe how a parse tree can be translated into a sequence of assembly language instructions based on a pattern matching graph derived from a

 

Describe how a parse tree can be translated into a sequence of assembly language instructions based on a pattern matching graph derived from a set of tree rewriting rules where each rule has a cost and a corresponding fragment of code. Illustrate your answer using the following rules: Ri = Kk LDI Ri,Kk Cost 2 Ri add (Ri, Kk) ADDI Ri, Kk Cost 3 Ri add (Ri, Rj) ADD Ri, Rj Cost 3 Ri = add (Ri, add (Rj, kk)) ADD Ri, Rj, Kk Cost 4. applied to the following parse tree: add (K1, add (add (K2, add (K3, K4)), add (K5,K6))) [15 marks] Discuss the advantages and disadvantages of this approach to code generation.

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

Artificial Intelligence Structures And Strategies For Complex Problem Solving

Authors: George Luger

6th Edition

0321545893, 9780321545893

Students also viewed these Programming questions