A systematic approach to the implementation of attribute grammars with conventional compiler construction tools

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.

[1]  José Luis Sierra,et al.  XML Language-Oriented Processing with XLOP , 2009, 2009 International Conference on Advanced Information Networking and Applications Workshops.

[2]  Ralph Johnson,et al.  design patterns elements of reusable object oriented software , 2019 .

[3]  Eric Van Wyk,et al.  Silver: an Extensible Attribute Grammar System , 2008, Electron. Notes Theor. Comput. Sci..

[4]  Jan van Katwijk A preprocessor for YACC or a poor man's approach to parsing attributed grammars , 1983, SIGP.

[5]  Henk Alblas,et al.  Attribute Evaluation Methods , 1991, Attribute Grammars, Applications and Systems.

[6]  Lex Augusteijn The Elegant Compiler Generator System , 1990, WAGA.

[7]  Terence Parr The Definitive ANTLR Reference: Building Domain-Specific Languages , 2007 .

[8]  Maria João Varanda Pereira,et al.  Automatic generation of language-based tools using the LISA system , 2005, IEE Proc. Softw..

[9]  S. Doaitse Swierstra,et al.  Higher order attribute grammars , 1989, PLDI '89.

[10]  Maria João Varanda Pereira,et al.  AspectLISA: An Aspect-oriented Compiler Construction System Based on Attribute Grammars , 2006, LDTA@ETAPS.

[11]  Jukka Paakki,et al.  Attribute grammar paradigms—a high-level methodology in language implementation , 1995, CSUR.

[12]  Maria João Varanda Pereira,et al.  Specifying languages using aspect-oriented approach: AspectLISA , 2006, 28th International Conference on Information Technology Interfaces, 2006..

[13]  Didier Parigot,et al.  Internals and Externals of the FNC-2 Attribute Grammar System , 1991, Attribute Grammars, Applications and Systems.

[14]  George C. Necula,et al.  Elkhound: A Fast, Practical GLR Parser Generator , 2003, CC.

[15]  William M. Waite,et al.  Modularity and reusability in attribute grammars , 1994, Acta Informatica.

[16]  Terence Parr,et al.  LL(*): the foundation of the ANTLR parser generator , 2011, PLDI '11.

[17]  Adrian Johnstone,et al.  Right nulled GLR parsers , 2006, ACM Trans. Program. Lang. Syst..

[18]  Bijan Arbab Compiling Circular Attribute Grammars Into Prolog , 1986, IBM J. Res. Dev..

[19]  Gregor von Bochmann,et al.  Semantic evaluation from left to right , 1976, CACM.

[20]  Borivoj Melichar,et al.  The Hierarchy of LR-Attributed Grammars , 1990, WAGA.

[21]  Arie van Deursen,et al.  The ASF+SDF Meta-environment: A Component-Based Language Development Environment , 2001 .

[22]  Hanspeter Mössenböck,et al.  A Generator for Production Quality Compilers , 1990, CC.

[23]  Eric Van Wyk,et al.  Context-aware scanning for parsing extensible languages , 2007, GPCE '07.

[24]  Daniel J. Rosenkrantz,et al.  Attributed Translations , 1974, J. Comput. Syst. Sci..

[25]  Torbjörn Ekman,et al.  The JastAdd system - modular extensible compiler construction , 2007, Sci. Comput. Program..

[26]  Nuno Oliveira,et al.  VisualLISA: A visual environment to develop attribute grammars , 2010, Comput. Sci. Inf. Syst..

[27]  Fahimeh Jalili,et al.  A general linear-time evaluator for attribute grammars , 1983, SIGP.

[28]  Donald E. Knuth,et al.  Semantics of context-free languages , 1968, Mathematical systems theory.

[29]  Andrew W. Appel,et al.  Modern Compiler Implementation in Java , 1997 .

[30]  Alfred V. Aho,et al.  Compilers: Principles, Techniques, and Tools , 1986, Addison-Wesley series in computer science / World student series edition.

[31]  Borivoj Melichar,et al.  Attribute Evaluation and Parsing , 1991, Attribute Grammars, Applications and Systems.

[32]  Jukka Paakki Prolog in Practical Compiler Writing , 1991, Comput. J..

[33]  Gilles Roussel,et al.  Tatoo: an innovative parser generator , 2006, PPPJ '06.

[34]  Daniel Rodriguez-Cerezo,et al.  Implementing attribute grammars using conventional compiler construction tools , 2011, 2011 Federated Conference on Computer Science and Information Systems (FedCSIS).

[35]  José Luis Sierra,et al.  A Prolog Framework for the Rapid Prototyping of Language Processors with Attribute Grammars , 2006, Electron. Notes Theor. Comput. Sci..

[36]  Görel Hedin,et al.  Circular reference attributed grammars - their evaluation and applications , 2003, Sci. Comput. Program..

[37]  Görel Hedin,et al.  An Object-Oriented Notation for Attribute Grammars , 1989, European Conference on Object-Oriented Programming.

[38]  Kurt M. Bischoff Design, Implementation, Use, and Evaluation of Ox: An Attribute- Grammar Compiling System based on Yacc, Lex, and C , 1992 .

[39]  Jukka Paakki,et al.  PROFIT: A System Integrating Logic Programming and Attribute Grammars , 1991, PLILP.

[40]  Laurie J. Hendren,et al.  SableCC, an object-oriented compiler framework , 1998, Proceedings. Technology of Object-Oriented Languages. TOOLS 26 (Cat. No.98EX176).

[41]  Ikuo Nakata,et al.  Rie, a compiler generator based on a one‐pass‐type attribute grammar , 1995, Softw. Pract. Exp..

[42]  Christopher G. Lasater,et al.  Design Patterns , 2008, Wiley Encyclopedia of Computer Science and Engineering.

[43]  M. J. Walsteijn,et al.  Attribute grammars in Prolog , 1986 .

[44]  Uwe Kastens,et al.  GAG: A Practical Compiler Generator , 1982, Lecture Notes in Computer Science.

[45]  W GrayRobert,et al.  Eli: a complete, flexible compiler construction system , 1992 .

[46]  Larry G. Jones,et al.  Efficient evaluation of circular attribute grammars , 1990, TOPL.

[47]  Ken Kennedy,et al.  A Deterministic Attribute Grammar Evaluator Based on Dynamic Scheduling , 1979, TOPL.

[48]  Axel T. Schreiner,et al.  Introduction to Compiler Construction with UNIX , 1985 .

[49]  Viswanathan Kodaganallur,et al.  Incorporating language processing into Java applications: a JavaCC tutorial , 2004, IEEE Software.

[50]  Viljem Zumer,et al.  LISA: An Interactive Environment for Programming Language Development , 2002, CC.

[51]  Anthony M. Sloane,et al.  Eli: a complete, flexible compiler construction system , 1992, CACM.