13.07.2015 Views

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

The PowerPC 604 RISC Microprocessor - eisber.net

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Printed by andi from a0.complang.tuwien.ac.atMar 29 1996 16:42 Karel<strong>The</strong>Robot.java Page 13void put_object_at_pos(int pos. Node node)if (pos 1)instruction . node;void printlint level) (Karel<strong>The</strong>Robot.println(level, 'BEGIN');Karel<strong>The</strong>Robot.print_instrIlevel, instruction);Karel<strong>The</strong>Robot.println(level. 'END");int exec_stepilif (Karel<strong>The</strong>Robot.offset 0)if (instruction null)return incomplete_program_error;Kerel<strong>The</strong>Robot.instruction • instruction;) elseKarel<strong>The</strong>Robot.offset 0;Karel<strong>The</strong>Robot.instruction instruction;return 0;Mar 29 1996 16:42 Karel<strong>The</strong>Robot.java Page 14Karel<strong>The</strong>Robot.println(level, 'MULE • • teat_names(test1 • ' DO');Karel<strong>The</strong>Robot.print_instr(level, instruction);int exec_step()if (test 0)return incomplete_program_error;if (Karel<strong>The</strong>Robot.off<strong>net</strong> 0)SackBuffer push(true);elseBackBuffer.push(felse);Karel<strong>The</strong>Robot.offset 0;if (KarelsWorld.test(test111if (instruction null)return incomplete_program_error;Karel<strong>The</strong>Robot.instruction • instruction;elseKarel<strong>The</strong>Robot.offaet . offset;Karel<strong>The</strong>Robot.instruction next;return 0;final class whileNode extends Node implements Globale (static final int description()(while_node, is_test, is_stmt, is_undef, is_undef);int test;Node instruction;whileNode()test undef_test;instruction . null;int length()return 2;int description(int pos)return description(pos);int get_int_at_pos(int post(it (pos 1)return test;return 0;void put_object_st_pos(int pos, int val) (if (pos 1)test • val;Node get_node_at_pos(int pos)(it (pos 2)return instruction;return null;void put_object_at_pos)int pos. Node node) (if (pos 21instruction • node;void print(int level)final class IterateNode extends Node implements Clobalsstatic final int description()(iterate_node, is_number, is_stmt, is_undef, is_undef);int count;Node instruction;static int stack() ■ new int(1024);static int top ■ 0;IterateNode()count 0;instruction • null;static void reset()top 0;int length()return 2;int description(int pos)return descrlption(pos);int get_int_at_pos(int post(if (pos 11return count;return 0;void put_object_at_pos(int pos, int val) (if (pos ... 1)count val;Node get_node_at_pos(int pos)(if (pos 2)return instruction;return null;)Karel<strong>The</strong>Robot.java 7

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!