O'Reilly logo

Compilers: Principles and Practice by Himanshu B. Dave, Parag H. Dave

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

5.4 Attribute Grammars

The processing required to build up the meaning of a higher syntactic construct from the meaning of a sequence of lower constructs is formalized by the use of attribute grammars.

We augment a grammar by associating attributes with each grammar symbol that describes its properties. An attribute has a name and an associated value, which may be a string, a number, a type, a memory location, an assigned register – whatever information we need to associate with that symbol in order to specify its meaning. For example, variables may have an attribute type, which keeps track of the declared type of a variable, useful later in type-checking or an integer constant may have an attribute numerical value, which we will later need to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required