Attribute Grammars in compilers

compilers@ima.UUCP
7 Jan 86 03:12:00 GMT

          From comp.compilers

Related articles
Attribute Grammars in compilers compilers@ima.UUCP (1986-01-07)
| List of all articles for this month |
Relay-Version: version B 2.10.2 9/12/84; site mit-hermes.ARPA
Posting-Version: Notesfiles $Revision: 1.6.2.16 $; site ima.UUCP
From: compilers@ima.UUCP
Newsgroups: mod.compilers
Date: 7 Jan 86 03:12:00 GMT
Article-I.D.: ima.136300018
Posted: Mon Jan 6 22:12:00 1986
Date-Received: 7 Jan 86 10:46:10 GMT
Nf-ID: #N:ima:136300018:000:1357
Nf-From: ima!compilers Jan 6 22:12:00 1986



[from wpl at ALLEGRA/PSUVAX1/BURDVAX (William P Loftus)]


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!


William Loftus
..!burdvax!wpl


215-648-7489


SDC Software R&D
PO Box 157
Paoli, PA 19301
--------



Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.