EXERCISES

  1. For a reasonably complete semantic check on the variables in a program, the following information may need to be associated with each variable a, by keeping it in its Symbol Table entry.
    • Does the program include a declaration for a?
    • Does the program include a definition for a?
    • What is the type of a?
    • Has a been properly initialized (before use)?
    • Does any function or statement ever use a?
    • What is the storage address of a?
    • Is a in the current scope?

    Considering the Node definition used by us, suggest ways in which this requirement be satisfied.

  2. Consider the grammar Gb given in the exercises of Chapter 4 for “Boolean expression calculator”. Express its attribute grammar in yacc format.
  3. Prepare an attribute grammar in yacc format for ...

Get Compilers: Principles and Practice now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.