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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>The</strong> interpreter is cIssical: it executes straight line codeand goto instructions. It is completely blind to the structureof the tree and requires neither recursion nor a stackto execute a file tree. Access to variables and proceduredefinitions is through a symbol table.<strong>The</strong> editor walks the tree using the same goto pointersas the interpreter. Each cursor position designates one ofthe nodes of the tree. Cursor motion is defined withrespect to a preorder traversal_ <strong>The</strong>re are no backwardpointers; thus, backward cursor motion is implementedinternally by going all the way around.B. DeclarationsAs demonstrated in Sec. LI.C, declarations present aspecial problem: modifying a declaration can simultaneouslyintroduce errors and correct errors at otherlocations in the program.. Internally, information aboutidentifiers is stored in a symbol table. When a declarationis modified, the Synthesizer discards the old symbol tableand traverses the tree in preorder reparsing and redoingthe semantics of every phrase. Phrases with errors are--Irked as invalid and are printed in the highlighted font_Len the screen is redrawn. Because the allocation ofvariables within an activation record is recomputed inthe process of reconstructing the symbol table, access tothe variables of a suspended activation record is lost inthe process. <strong>The</strong>refore, execution cannot be resumedafter such modifications.C. Displaying the Tree<strong>The</strong> print representation of a file is generated fromthe tree; a text representation is not saved.. <strong>The</strong> externalrepresentation of each kind of template is stored in atable: <strong>The</strong> entries of this table alternate between terminalstrings and placeholder-descriptors. For example, the IFtemplateis encoded as:"IFcondition-descriptor") \ \nTHEN"--gement-I-descriptor_LSE"statement-2-descriptor<strong>The</strong> placeholder-descriptors identify the placeholdersand their positions within the code section of an internalnode. <strong>The</strong> terminal strings contain key words, punctuationmarks, and formatting control characters that areinterpreted on output. For example,\ ( means move left -margin right one unit,\n means line-feed, carriage-return to current left -mar-gin,\} means move left-margin left one unit,\r means carriage-return to current left-margin.<strong>The</strong> print routine traverses the tree in preorder, simultaneouslykeeping track of position within the externalrepresentation of the appropriate template. Each term:-nal string encountered is printed and its formattingcommands obeyed. Each phrase is translated from postfixto infix for display. (<strong>The</strong> parentheses of a phrase aresaved in the extension of the node encoded one bit peroperator.)As the tree is traversed for display, a table mappinginternal node addresses to external screen coordinates isupdated_ This table is used both for cursor motion in theeditor, and at runtime for the trace feature_D. Implementation of Debugging Features<strong>The</strong> tracing, pacing, and single-step features are implementedby taking appropriate action on the interpretationof each goto leading to a new node.When tracing, each goto uses the map from internalnode addresses to screen coordinates to determi<strong>net</strong>he new cursor'position. If the map is not defined for agiven target node, then the cursor lies outside the windowand the program is redrawn with the new cursor positioncentered in the window. Traced programs are neverpermitted to run any faster than one cursor update perrefresh of the video screen in order to avoid stroboscopiceffects such as loops that appear to run backwards. Whenpacing, the interpreter waits appropriately at eachgoto before continuing execution. When stepping, theinterpreter waits for a resume command before continuing.<strong>The</strong> variable-monitoring feature is implemented in astraightforward manner. a table mapping identifiers toscreen positions is maintained. Assignment to a monitoredvariable is detected by the interpreter whereuponthe appropriate position is updated on the screen.Reverse execution also has a straightforward implementation:the forward execution interpreter maintainsa history file of the flow of control and the valuesdestroyed by assignments to variables. <strong>The</strong> reverse executioninterpreter restores values and updates the screento give the illusion of the program executing backwards.VII. Tne Synthesizer GeneratorContinuing research and development of the Synthesizerwill increase its power, versatility, and range ofapplication complementing the unique syntax-directedmechRnisms the environment already provides. For example,global data flow analysis techniques will be usedto answer queries about static program structure, as in[IS]. <strong>The</strong> video display can be used to express staticrelationships between components of a program; themultiple fonts of a terminal can be exploited to highlightregions of interest. For example, the programmer mightrequest the highlighting of all uses or all assignments toa variable X. Alternatively, the analysis can be keyed tothe present location of the editing cursor. For example.,the programmer might request the highlighting of allassignments to X that can account for its value at thepresent cursor location, or all possible uses of X that can572 Communications September 1981of Volume 24thc ACM Number 9

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

Saved successfully!

Ooh no, something went wrong!