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.

6f)Printed by andi from a0.complang.tuwien.ac.atMar 29 1996 16:42 Karel<strong>The</strong>Robot.java Page 11Karel<strong>The</strong>Robot.print(0, name.oet_name(1);Karel<strong>The</strong>Robot.println(0, AS'1;instructlon.printIlevel • 1);static int pushICallNode caller) (to••;if (top >- stack.lengthlreturn stack_overflow_error;Astack(top) • caller;Kat el<strong>The</strong>Roloot . instruct ion m cal Le...r....eielITITFTTITi7tttif lne instruct ion;return 0;int exec_step() (if (Karel<strong>The</strong>Robot.offset 0)return internal_program_error;Karel<strong>The</strong>Robot.offset • stack(top).offset;Kerel<strong>The</strong>Robot.instruction stackltopl.next;top--;return 0;final class Name implements Olobals(private static Name name_listString name;DefineNode define;private Name next;null;NamelString name, DefineNode define)this.name name;thls.define define;this.next ■ name_list;name_list • this;public String get_name))return this.name;public static Name enter_namelString name, DefineNode definition)Name nlist • name_list;while Inlist null)if inlist.name.equalsIneme))if Inlist.deflne null)nlist.define . definition;return fillet;► elsereturn null;nlist • nlist.neKt;return new NameIname, definition);public static DefineNode find_name(String name)Name nlist name_list;while (nlist I. null) (if (nlist.name.equals(name))return nlist.define;nlist • nlist.next;new NameIname, null);return null;Mar 29 1996 16:42 Karel<strong>The</strong>Robot.java Page 12final class ExecutionNode extends Node implements Globalsstatic final int description()(execution_node,Node instruction;ExecutionNode()instruction • null;int description(int poe)return description(pos);Node get_node_at_pos(int pos)(if (pos 1)return instruction;return null;void put_object_at_pos(int pos, Node node)if (pos 1)instruction node;is_undef, is_undef, is_undef);void print(int level)Karel<strong>The</strong>Robot.println(level, 'BEGINNING-OF-EXECUTION');Karel<strong>The</strong>Robot.print_i<strong>net</strong>rIlevel, instruction);Karel<strong>The</strong>Robot.println(level, 'END-OF-EXECUTION•);int exec_otep()if (Karel<strong>The</strong>Robot.offset .• 0) (if (instruction null)return incomplete_program_error;Karel<strong>The</strong>Robot.instruction instruction;) elseKarel<strong>The</strong>Robot.offeet 0;Karel<strong>The</strong>Robot.i<strong>net</strong>ruction . Instruction;return 0;final class DlockNode extends Node implements Globalsstatic final int description() .(block_node,is_undef, is_undef, is_undef);Node instruction;BlockNode)) (instruction . null;int description(int pos)return description(pos);Node get_node_st_pos(lnt pos)(if (poe •. 1)return instruction;return null;Karel<strong>The</strong>Robot.java 6

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

Saved successfully!

Ooh no, something went wrong!