[net.lang] Attribute Grammars used in compilers

wpl@burdvax.UUCP (William P Loftus) (01/04/86)

I'm interested in finding people that have used attribute grammars to
aid the development of a real live compiler. I am specifically interested
in finding out the pragmatics used in specifying the AG.  What I mean by
pragmatics is "what was specified, from what kind of node, and to what kind 
of node."  Here is an example of what I mean:

	The grammar is as follows

		A ::= B C 	[ A.j := B.i * C.k; A.i := B.i; A.k := C.k;]
		B ::= By 	[ B.i := B.i + 1;]
		B ::= y		[ B.i := 1;]
		C ::= Bx 	[ C.k := B.i + 1;]

	Node A has three attributes (A.i, A.j, A.k).
	Node B has one attribute (B.i).
	Node C has three attributes (C.k).

Since A is copying attributes i and k from a child and also calculating
attribute j from the same attributes, is it better to get the values (that
j is calculated)  from the children nodes or to calcuate them from attributes
in the same node?

This type of example appears many times when specifying attributes.  Other
pragmatic issues are "How far down the tree, or up the tree should you
calculate information?"  and "What should be calculated with attributes and
What should be calculated by a backend?"

Please respond to mod.compilers, so we can get ideas flowing!


-- 
      /       
     /         /======/     		Ronin   ..!burdvax!wpl
=======       /      /
/  /  /      /======/
======      /      /
 /         /======/
/

wpl@burdvax.UUCP (William P Loftus) (01/07/86)

>
>       Node A has three attributes (A.i, A.j, A.k).
>       Node B has one attribute (B.i).
>       Node C has three attributes (C.k).
>

Sorry, Node C has one attribute not three!

--
      /
     /         /======/                 Ronin   ..!burdvax!wpl
=======       /      /
/  /  /      /======/
======      /      /
 /         /======/
/