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.

immediately that 'I' has type integer (or a wUbrange thereof), that 'a' is ame-dimensional array with index and component type integer, and that thestill missing right-hand side of the assignment mist also be compatible withinteger. If a user types 'TRUE' as the right aide, a semantic error mustIn addition, the mom for the right-band sideimmediately be reported.tomplate should be filtered in such a way that the menu item for theconstant 'ME' will not be displayed, as well as all other non-integerexpression items.<strong>The</strong> classical methods follow the schemot first inspect the declarations andcollect information about e.g. types of variables, then use this informationto check typo inoompatibilities in expressions etc. This schAme does notwork in the above example.<strong>The</strong> concept of context relations (Hen84] has been developed to overcomethese difficulties with the classical methods. <strong>The</strong> basic idea is to computea <strong>net</strong> of still possible attributes for each node of an incxxipleta frageeelt.A collection of still poesible attribute assignments to the nodes of afragment is called a context relation. If such a relation consists ofexactly o<strong>net</strong>uple, the context information is unambiguous. If a relation isempty, a semantic error has been detected. It can be shown that the contextrelation of a composite fralmmit is just the natural join of the relationsof its Subfragments. <strong>The</strong>refore context conditions any be computed incrementallyduring editing. As context relations are in general of infinite size,they are represented in a finite way using eo-called term form relationswith variables. <strong>The</strong> basic idea is to describe the set of poopible attributesby a granuar, the yo-called data attribute grammar. ...Infinite seta ofattributes are then representedby incomplete derivation trees according tothe data attribute grammar: in addition these derivation treesarbitrary functional dependenciee between (uUb)trees.any containTo specify contextconditions, the Language definer first has to define thescope and visibility rules of the language. This information is used todetermine whether all the different occurences of an identifier in afragment actually denote the SAW "abstract" identifier. If so, theircorresponding cats of still possible attribute values may be intersected.<strong>The</strong> second part of the context conditions definition is the speCification ofthe data attribute grammar. }ere, the structure of the attributes of thelanguage isdefined. Typical rules lock like this:-etc.CLASSordina, integer, Boolean, eUbrange, enumeration,MOE settype s: ordinal:NCCIE arraytype Is index types typo;LIST index_types m ordinal+rCLASS class ■ variable, ctype, constant, procedure,<strong>The</strong> attribute format definition forms the third part of the co text conditionsdefinition. Sinner to the format definition of the context-free partof the lanc-aage definition, it specifies how attributes shall be displayedto the user if he looks at the syetol table.<strong>The</strong> last and most important part of the context condition definition is thespecification of the so-called basic relations, which meat be specified forall terminals and each node rule of the abstract syntax. As the oontextrelation ofa fragment is the join of the relations of its components,specification of the basic relations provides enough informaticx: to analyseeach 'fragment incrementally. A basic relation consists of a set'of tupleswhich define a (posiibly infinite) <strong>net</strong> of attribute assigunents to thecomponents of a node rule rasp. a terminal. For instance, the basic relationof a syntactic integer number consisting of a single tuple might be:Intl MK-attribute(integer, constant);which specifies that an integer number hai type integer and ie a constant.More sophisticated apecifications can be Obtained by using variables, whichspecify that certain sub ' attributes must be identical. <strong>The</strong> basic relation foran assignmentassignment it ,variable expressioncontains three tupels, which use the variable TYPE:asaignments MOIL MK-attribute(TYPE, variable) 14C- attribute(TYPE, computational)I NIL IBC-attribute( real, Variable) MK-attribute( integer, computational)I Kit Mk-attribute(TYPE, function) MK-attribute(TYPE, computational):which says that in an assignment either- the left-hand side is a variable of a certain TYPE, and the right-handside is an expression of the same TYPE, or- the left-hand Bide is a real variable, and the right-hand side is aninteger expression, or- 'the left-hsnd aide is a function identifier with a certain result TYPE,• • •NOCE attribute it type class;CLASS type aimple_type, array type, sat_type, ...CIASS simple_type ∎ arithmntic, ordinal:

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

Saved successfully!

Ooh no, something went wrong!