A Systematic Approach to the Implementation of Attribute Grammars with Conventional Compiler Construction Tools
- Computer Science School, Complutense University of Madrid
Calle Profesor Jose Garcia Santesmases, s/n, 28040 Madrid, Spain
{drcerezo, asarasa, jlsierra}@fdi.ucm.es
Abstract
This article describes structure-preserving coding patterns to code arbitrary non-circular attribute grammars as syntax-directed translation schemes for bottom-up and top-down parser generation tools. In these translation schemes, semantic actions are written in terms of a small repertory of primitive attribution operations. By providing alternative implementations for these attribution operations, it is possible to plug in different semantic evaluation strategies in a seamlessly way (e.g., a demand-driven strategy, or a data-driven one). The pattern makes possible the direct implementation of attribute grammar-based specifications with widely-used translation schemedriven tools for the development of both bottom-up (e.g. YACC, BISON, CUP) and top-down (e.g., JavaCC, ANTLR) language translators. As a consequence, initial translation schemes can be successively refined to yield final efficient implementations. Since these implementations still preserve the ability to be extended with new features described at the attribute grammar level, the advantages from the point of view of development and maintenance become apparent.
Key words
Attribute Grammars, Parser Generators, Language Processor Development Method, Grammarware
Digital Object Identifier (DOI)
https://doi.org/10.2298/CSIS111223022R
Publication information
Volume 9, Issue 3 (September 2012)
Special Issue on Advances in Computer Languages, Modeling and Agents
Year of Publication: 2012
ISSN: 2406-1018 (Online)
Publisher: ComSIS Consortium
Full text
Available in PDF
Portable Document Format
How to cite
Rodriguez-Cerezo, D., Sarasa-Cabezuelo, A., Sierra, J.: A Systematic Approach to the Implementation of Attribute Grammars with Conventional Compiler Construction Tools. Computer Science and Information Systems, Vol. 9, No. 3, 983-1018. (2012), https://doi.org/10.2298/CSIS111223022R