Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

Translate the following four BL programs into their executable form in the tables next to each example using the code generation patterns discussed in class(especially

Translate the following four BL programs into their executable form in the tables next to each example using the code generation "patterns" discussed in class(especially slides 30-47).

http://web.cse.ohio-state.edu/software/2231/web-sw2/extras/slides/28.Code-Generation.pdf

Use only the primitives: MOVE, TURNLEFT, TURNRIGHT, INFECT, SKIP, and HALT; unconditional jump: JUMP; and the conditional jumps: JUMP_IF_NOT_NEXT_IS_EMPTY, JUMP_IF_NOT_NEXT_IS_NOT_EMPTY, etc.) Note that the tables may be bigger than the actual length of the generated code.

PROGRAM Example1 IS BEGIN IF next-is-wall THEN turnright turnright infect END IF END Example1 
0
1
2
3
4
5
6
7
8
9
10
PROGRAM Example2 IS BEGIN IF next-is-wall THEN turnright turnright infect ELSE infect move END IF END Example2 
0
1
2
3
4
5
6
7
8
9
10
PROGRAM Example3 IS BEGIN WHILE next-is-not-empty DO IF next-is-wall THEN turnright turnright infect ELSE infect move END IF END WHILE END Example3 
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
PROGRAM Example4 IS INSTRUCTION TurnBackAndInfect IS turnright turnright IF next-is-enemy THEN infect END IF END TurnBackAndInfect BEGIN WHILE true DO TurnBackAndInfect END WHILE END Example4 
0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

Step by Step Solution

There are 3 Steps involved in it

Step: 1

The question is incomplete because it refers to ... 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_2

Step: 3

blur-text-image_3

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

DB2 9 For Linux UNIX And Windows Advanced Database Administration Certification Certification Study Guide

Authors: Roger E. Sanders, Dwaine R Snow

1st Edition

1583470808, 978-1583470800

More Books

Students explore these related Databases questions