skip to main content
10.1145/3297280.3299738acmconferencesArticle/Chapter ViewAbstractPublication PagessacConference Proceedingsconference-collections
research-article

An attribute language definition for adaptable parsing expression grammars

Published:08 April 2019Publication History

ABSTRACT

Adaptable Parsing Expression Grammars (APEG) are a formal model whose main purpose is to formally describe the syntax of extensible languages and their extension mechanisms. APEG extends Parsing Expression Grammar model with the notion of syntactic attributes, which are values passed through parse tree nodes and used during the parsing process. A grammar is a first-class value passed to every nonterminal, and the rules used during the parsing are fetched from this grammar. The ability to change and pass different grammars is the key to dynamically extend the original language grammar. The reported implementation of APEG attributes uses strings and ad hoc Java code to manipulate and build grammars during parsing time. This approach has at least three disadvantages: a grammar specification becomes dependent on the language in which the functions to manipulate and build new grammars were implemented; we may not assure that the grammars built are always syntactically correct; and it is virtually impossible to prove that the generated parser does not lead to a infinite loop. In this work, we formally define an attribute language for APEG containing operators to manipulate grammars. As a result, new rules and grammars built during parsing time are syntactically correct. In addition, we define a restriction on APEG rules that assures that any generated parser will terminate on all inputs.

References

  1. William J. Bowman. 2016. Growing a Proof Assistant. https://www.williamjbowman.com/resources/cur.pdfGoogle ScholarGoogle Scholar
  2. Martin Bravenboer, Karl T. Kalleberg, Rob Vermaas, and Eelco Visser. 2008. Stratego/XT 0.17. A language and toolset for program transformation. Science of Computer Programming 72, 1-2 (2008), 52--70. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Cristiano Calcagno, Walid Taha, Liwen Huang, and Xavier Leroy. 2003. Implementing Multi-stage Languages Using ASTs, Gensym, and Reflection. In Generative Programming and Component Engineering, Frank Pfenning and Yannis Smaragdakis (Eds.). Springer Berlin Heidelberg, Berlin, Heidelberg, 57--76. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Adam Carmi. 2010. Adaptive Multi-pass Parsing. Master's thesis. Israel Institute of Technology.Google ScholarGoogle Scholar
  5. Henning Christiansen. 1990. A survey of adaptable grammars. SIGPLAN Not. 25 (1990), 35--44. Issue 11. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Sebastian Erdweg, Stefan Fehrenbach, and Klaus Ostermann. 2014. Evolution of Software Systems with Extensible Languages and DSLs. IEEE Software 31, 5 (2014), 68--75.Google ScholarGoogle ScholarCross RefCross Ref
  7. Sebastian Erdweg, Tillmann Rendel, Christian Kästner, and Klaus Ostermann. 2011. SugarJ: library-based syntactic language extensibility. In Proceedings of the 2011 ACM international conference on Object oriented programming systems languages and applications (OOPSLA'11). ACM, New York, NY, USA, 391--406. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Bryan Ford. 2004. Parsing Expression Grammars: A Recognition-based Syntactic Foundation. In Proceedings of the 31st Symposium on Principles of Programming Languages (POPL'04). ACM, New York, NY, USA, 111--122. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. J. Heering, P. R. H. Hendriks, P. Klint, and J. Rekers. 1989. The syntax definition formalism SDF reference manual. SIGPLAN Not. 24, 11 (1989), 43--75. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. S. Shan Huang, David Zook, and Yannis Smaragdakis. 2008. Domain-specific Languages and Program Generation with meta-AspectJ. ACM Trans. Softw. Eng. Methodol. 18, 2, Article 6 (2008), 32 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Shan S. Huang, David Zook, and Yannis Smaragdakis. 2011. Statically safe program generation with SafeGen. Science of Computer Programming 76, 5 (2011), 376 -- 391. Special Issue on GPCE 2004/2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Ted Kaminski and Eric Van Wyk. 2017. Ensuring Non-interference of Composable Language Extensions. In Proceedings of the 10th ACM SIGPLAN International Conference on Software Language Engineering (SLE 2017). ACM, New York, NY, USA, 163--174. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Lennart C.L. Kats and Eelco Visser. 2010. The Spoofax Language Workbench: Rules for Declarative Specification of Languages and IDEs. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA'10). ACM, New York, NY, USA, 444--463. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Florian Lorenzen and Sebastian Erdweg. 2016. Sound Type-dependent Syntactic Language Extension. In Proceedings of the 43rd Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'16). ACM, New York, NY, USA, 204--216. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Leonardo V.S. Reis, Roberto S. Bigonha, Vladimir O. Di Iorio, and Luis Eduardo S. Amorim. 2012. Adaptable Parsing Expression Grammars. In Programming Languages, Francisco Heron Carvalho Junior and Luis Soares Barbosa (Eds.). Lecture Notes in Computer Science, Vol. 7554. Springer Berlin Heidelberg, 72--86. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Leonardo V.S. Reis, Roberto S. Bigonha, Vladimir O. Di Iorio, and Luis Eduardo S. Amorim. 2014. The formalization and implementation of Adaptable Parsing Expression Grammars. Science of Computer Programming 96, Part 2 (2014), 191 -- 210. Selected and extended papers of the SBLP 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Leonardo V. S. Reis, Vladimir O. Di Iorio, and Roberto S. Bigonha. 2014. Defining the Syntax of Extensible Languages. In Proceedings of the 29th Annual ACM Symposium on Applied Computing (SAC'14). ACM, New York, NY, USA, 1570--1576. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. August C. Schwerdfeger and Eric Van Wyk. 2009. Verifiable Composition of Deterministic Grammars. In Proceedings of the 30th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'09). ACM, New York, NY, USA, 199--210. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. John N. Shutt. 1998. Recursive Adaptable Grammars. Master's thesis. Worchester Polytechnic Institute.Google ScholarGoogle Scholar
  20. Paul Stansifer and Mitchell Wand. 2011. Parsing Reflective Grammars. In Proceedings of the Eleventh Workshop on Language Descriptions, Tools and Applications (LDTA '11). ACM, New York, NY, USA, Article 10, 7 pages. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Sam Tobin-Hochstadt, Vincent St-Amour, Ryan Culpepper, Matthew Flatt, and Matthias Felleisen. 2011. Languages as libraries. In Proceedings of the 32nd ACM SIGPLAN conference on Programming language design and implementation (PLDI'11). ACM, New York, NY, USA, 132--141. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. David A. Watt and Ole Lehrmann Madsen. 1983. Extended Attribute Grammars. Comput. J. 26, 2 (1983), 142--153.Google ScholarGoogle ScholarCross RefCross Ref
  23. Eric Van Wyk, Derek Bodin, Jimin Gao, and Lijesh Krishnan. 2010. Silver: An extensible attribute grammar system. Science of Computer Programming 75, 1 (2010), 39 -- 54. Special Issue on LDTA 06/07. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. An attribute language definition for adaptable parsing expression grammars

    Recommendations

    Comments

    Login options

    Check if you have access through your login credentials or your institution to get full access on this article.

    Sign in
    • Published in

      cover image ACM Conferences
      SAC '19: Proceedings of the 34th ACM/SIGAPP Symposium on Applied Computing
      April 2019
      2682 pages
      ISBN:9781450359337
      DOI:10.1145/3297280

      Copyright © 2019 ACM

      Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 8 April 2019

      Permissions

      Request permissions about this article.

      Request Permissions

      Check for updates

      Qualifiers

      • research-article

      Acceptance Rates

      Overall Acceptance Rate1,650of6,669submissions,25%

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader