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.

Being the folart, part of the syntax definition, the format definition.is aand mews offered to the user are generated<strong>The</strong> structure oriented commandsaccording to the abstract syntax. Fbr example, each template is associatedwith a menu of refinement poesibilities. Plowever, this menu is dynamicallyfiltered with respect to context conditions (s ►e below).of the syntax definition, is<strong>The</strong> concrete syntax, %JhiCh is the third partused to generate an Lncrenental perstr. <strong>The</strong> concrete syntax is restricted tofull LL(1)grammars. It includes transformation rules Which specify how tobuild abstract trees from textual input. Thusthe concrete syntax isgrammar. Concrete syntax rules lbOkactually a etring-to-tree transformationLike this:etc.statementINOCE for, Id, beccmcs, expression, tocrdoento, expression,do, statemesitforetatementI'NOOE begin, statementlist, end ■ > compcundI tixc Id, optparameterlistetatementlist ,:e LIST statement+-sem,optparameterList(ip,parrumeterlist,rp),toords.dnto TERAINAL to 1 TERMINAL clowntor<strong>The</strong> NOOE, LIST and reainvq, keywords and thecall:specify hoe' to build the abstract tree during the parsingthe situation is not alway'3 thatE. 1'. and se , ' delimitersprocess. Weever,simple. Frequently, a concrete syntax doesnot rerely reflect the rules of the abstract syntax, due to operatorprecMenoes or left-factoriration used to avoid 1L(11 -conflicts. Forexample,expreesirn to. simple_expression, sinplexpr_tailleimple_expression tve factor. ...;sinpleexpr_tall : UMATENDDE equal, cimple_expressienI EMPTY,e> equalexprHere, the UPS:MOM and EMPTY rules will construct a correct equal_exprnode, although the rules reflect operator precedence and are left-factori-tad.lha parser will part;e anyinput entered in textual mode. It accepts arbitraryvalid prefixes of any input conforming to the syntactical category of agiven template. If.any syntax errors are detected, a recovery routine willcompote a menu comprising all local correction possibilities, .Mich ispresented to the user. <strong>The</strong> user may then correct his input either in textualerrs or by selection among the menu items.tree-to-string transformation grammar which is used to co<strong>net</strong>ruct theexternal textual representation of an abstract tree. Prettyprinting inborrationis part of the format definition:forstatement e> 1 for Id becomes expression to expression do statement C2),ifetatement e) 1 if expression then statement(2) (statement[2] -) I alse,),In the example, .1 . means start of a new line, and indentation factors maybe specified inside square brackets. Parentheses are used to specifyconditional formatting* the keyword 'ELSE' will be displayed only if theoptional else-part of an 'ifstatemene is indeed present. Ocoditionalformatting is used also to re-insert parentheses into expressions ifnoccessary due to operator precedence (note that parentheses are discardedduring parsing and that operator precedences are reflected by the abstracttree's structure). A string-to-tree-to-string transformation which isperformed by 'parsing textual input, building the abstract tree anJ pretty--printing the abstract tree must yield the original input text exactlyexcept for spaces, newlines and redundant parentheses.In the last part of the syntax definition, header° and menu texts have to bespecified which are used to generate the textual representation of templatesand menus. Fbr each name ocCurirg in the abstract syntax an external namehas to be specified:.statement -> 'Anweisung':ifstatament ->'Bedingte Anweieung',Dor each syntactic class, menu texts have to be specified,:statement ->'FCA-Anweisung','Verbundanwoisung',Fbr purposes of generality, syntactic entities may posses different externalnames, depending on their occurrence in templates or in menus.<strong>The</strong> definition of context conditions<strong>The</strong> context analysis of PS has been of special interest, since the'classicalmethods like attributed grammars [Knael.] turned out to be inadequateeven if attribute evaluation is performed incrementally Dep93]. COnsiderthe following situation, In a PASCAL programfrageent, the variables 'a' and'i' have not yet been declared or used, and a d eclaratial-tenpl ate is stillpresent. Now the user enters an incomplete assignmentaaraCi+1311 ■Although 'a' and 'i' arestill undeclared, the context analysis nust derive

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

Saved successfully!

Ooh no, something went wrong!