Circular Reference Attributed Grammars - their Evaluation and Applications
Eva Magnusson, Görel Hedin · Electronic Notes in Theoretical Computer Science · 2003
This paper presents a combination of Reference Attributed Grammars (RAGs) and Circular Attribute Grammars (CAGs). While RAGs allow the direct and easy specification of non-locally dependent information, CAGs allow iterative fixed-point computations to be expressed directly using recursive (circular) equations. We demonstrate how the combined formalism, Circular Reference Attributed Grammars (CRAGs), can take advantage of both these strengths, making it possible to express solutions to many problems in an easy way. We exemplify with the specification and computation of the nullable, first, and follow sets used in parser construction, a problem which is highly recursive and normally programmed by hand using an iterative algorithm. We also present a general demand-driven evaluation algorithm for CRAGs and some optimizations of it. The approach has been implemented and experimental results include computations on a series of grammars including that of Java 1.2. We also revisit some of the classical examples of CAGs and show how their solutions are facilitated by CRAGs.
Cited by 20 works. doi:10.1016/s1571-0661(05)82627-1 Open-access PDF
Authors
References
- Semantics of context-free languages
- Modern Compiler Implementation in Java
- Ordered attributed grammars
- Reference Attributed Grammars
- Translation of attribute grammars into procedures
- Automatic generation of fixed-point-finding evaluators for circular, but well-defined, attribute grammars
- On defining semantics by means of extended attribute grammars
- Modern Compiler Implementation in Java
- An Object-Oriented Notation for Attribute Grammars.
- Prototyping realistic programming languages based on formal specifications