Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

SCHEME R5RS: Given this as input: (define tree '(S ((- (A 3333) (A 4444))(W(+ (R 0) (R 1))(+ (R 1) (R 2))(+ (R 2) (R

SCHEME R5RS:

Given this as input:

(define tree '("S" (("-" ("A" 3333) ("A" 4444))("W"("+" ("R" 0) ("R" 1))("+" ("R" 1) ("R" 2))("+" ("R" 2) ("R" 3))("+" ("R" 3) ("R" 4))("+" ("R" 4) ("R" 5))) (("-" ("R" 0) ("R" 1))("-" ("R" 1) ("R" 2))("-" ("R" 2) ("R" 3))("-" ("R" 3) ("R" 4))("-" ("A" 1000) ("A" 2000))))("" ("R" 2) ("R" 3))))

Create a scheme R5RS program to produce the following output:

0: sub $3333 $4444 1: add R0 R1 2: add R1 R2 3: add R2 R3 4: add R3 R4 5: add R4 R5 6: bne $00000000 7: jmp 0 8: sub R0 R1 9: sub R1 R2 10: sub R2 R3 11: sub R3 R4 12: sub $1000 $2000 13: bne $00000000
14: jmp $7

More specifically, create a program in Scheme R5RS to go through the list of lists and use recursion to iterate through and print the proper output. "S" is a statement node, "W" is a while node with conditions and statements, and { "+", "-", "*", "/" } refer as Two Operand nodes which are simply add, sub, mul, div with the register and or address.

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books