Title :
Implementing attribute grammars using conventional compiler construction tools
Author :
Rodríguez-Cerezo, Daniel ; Sarasa-Cabezuelo, Antonio ; Sierra, José-Luis
Author_Institution :
Fac. de Inf., Univ. Complutense de Madrid, Madrid, Spain
Abstract :
This article describes a straightforward and structure-preserving coding pattern to encode arbitrary non-circular attribute grammars as syntax-directed translation schemes for bottom-up parser generation tools. According to this pattern, a bottom-up oriented translation scheme is systematically derived from the original attribute grammar. Semantic actions attached to each syntax rule 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 it possible the direct implementation of attribute grammar-based specifications using widely-used translation scheme-driven tools for the development of bottom-up language translators (e.g. YACC, BISON, CUP, etc.). As a consequence, this initial coding can be subsequently refined to yield final efficient implementations. Since these implementations still preserve the ability of being extended with new features described at the attribute grammar level, the advantages from the point of view of development and maintenance become apparent.
Keywords :
attribute grammars; formal specification; program compilers; attribute grammar-based specification; bottom-up language translator; bottom-up oriented translation scheme; bottom-up parser generation tool; conventional compiler construction tool; data-driven strategy; demand-driven strategy; primitive attribution operation; structure-preserving coding pattern; syntax-directed translation scheme; translation scheme-driven tool; Computer languages; Encoding; Equations; Generators; Grammar; Program processors; Semantics;
Conference_Titel :
Computer Science and Information Systems (FedCSIS), 2011 Federated Conference on
Conference_Location :
Szczecin
Print_ISBN :
978-1-4577-0041-5
Electronic_ISBN :
978-83-60810-35-4