Minimizing the Number of Evaluation Passes for Attribute Grammars
The problem of constructing multi-pass evaluators for attribute grammars is studied. We show that the construction algorithm used heretofore can in the worst case produce evaluators which perform $2n - 1$ passes over the parse tree, where $n$ is the minimum number of passes required. Furthermore, th...
Saved in:
Published in | SIAM journal on computing Vol. 10; no. 4; pp. 772 - 786 |
---|---|
Main Authors | , |
Format | Journal Article |
Language | English |
Published |
Philadelphia
Society for Industrial and Applied Mathematics
01.11.1981
|
Subjects | |
Online Access | Get full text |
Cover
Loading…
Summary: | The problem of constructing multi-pass evaluators for attribute grammars is studied. We show that the construction algorithm used heretofore can in the worst case produce evaluators which perform $2n - 1$ passes over the parse tree, where $n$ is the minimum number of passes required. Furthermore, the problem of constructing an optimal evaluation order is shown to be NP-complete. We then develop a new characterization for attribute grammars evaluable in passes. It can be directly applied as an efficient membership test. Finally, the characterization is used for deriving a polynomial time construction algorithm for a large subclass of pass-oriented attribute grammars. The subclass is argued to be of practical importance. |
---|---|
ISSN: | 0097-5397 1095-7111 |
DOI: | 10.1137/0210060 |