[go: up one dir, main page]
More Web Proxy on the site http://driver.im/ 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 2019 Publication 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.pdf
[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.
[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.
[4]
Adam Carmi. 2010. Adaptive Multi-pass Parsing. Master's thesis. Israel Institute of Technology.
[5]
Henning Christiansen. 1990. A survey of adaptable grammars. SIGPLAN Not. 25 (1990), 35--44. Issue 11.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[19]
John N. Shutt. 1998. Recursive Adaptable Grammars. Master's thesis. Worchester Polytechnic Institute.
[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.
[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.
[22]
David A. Watt and Ole Lehrmann Madsen. 1983. Extended Attribute Grammars. Comput. J. 26, 2 (1983), 142--153.
[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.

Cited By

View all
  • (2023)A Haskell Library for Adaptable Parsing Expression GrammarsProceedings of the XXVII Brazilian Symposium on Programming Languages10.1145/3624309.3624313(73-81)Online publication date: 25-Sep-2023

Index Terms

  1. An attribute language definition for adaptable parsing expression grammars

    Recommendations

    Comments

    Please enable JavaScript to view thecomments powered by Disqus.

    Information & Contributors

    Information

    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
    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]

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 08 April 2019

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. APEG
    2. PEG
    3. attributes
    4. extensible languages
    5. parsing

    Qualifiers

    • Research-article

    Funding Sources

    Conference

    SAC '19
    Sponsor:

    Acceptance Rates

    Overall Acceptance Rate 1,650 of 6,669 submissions, 25%

    Upcoming Conference

    SAC '25
    The 40th ACM/SIGAPP Symposium on Applied Computing
    March 31 - April 4, 2025
    Catania , Italy

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)4
    • Downloads (Last 6 weeks)1
    Reflects downloads up to 13 Dec 2024

    Other Metrics

    Citations

    Cited By

    View all
    • (2023)A Haskell Library for Adaptable Parsing Expression GrammarsProceedings of the XXVII Brazilian Symposium on Programming Languages10.1145/3624309.3624313(73-81)Online publication date: 25-Sep-2023

    View Options

    Login options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media