Abstract
Developing families of software languages requires, among others, composable grammar definitions. Object Parsing-Expression Grammars (OPEGs) serve as such grammars that can be composed without preplanning and in an unmodified manner, either via grammar unions or via fine-grained grammar transformations. In addition, OPEGs help avoid typical pitfalls (abstraction mismatches) of using intermediate parse representations (e.g., parse trees) when parsing to object graphs. The paper documents the design and implementation of OPEGs on top of a packrat parser as well as advanced features of OPEGs (e.g., handling multi-value properties, non-positional parsing). An OPEG implementation is available as part of DjDSL, a development system for domain-specific languages (DSLs).
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
References
Avgeriou, P., Zdun, U.: Architectural patterns revisited: A pattern language. In: Proceedings of 10th European Conference on Pattern Languages of Programs (EuroPlop 2005), pp. 1–39. Irsee, Germany, July 2005
Bettini, L.: Implementing Domain-Specific Languages with Xtext and Xtend. 2nd edn. Packt Publishing, Birmingham (2013)
Cordy, J.R.: The TXL source transformation language. Sci. Comput. Program. 61(3), 190–210 (2006). https://doi.org/10.1016/j.scico.2006.04.002
Degueule, T.: Composition and Interoperability for External Domain-Specific Language Engineering. Theses, Université de Rennes 1, [UR1], December 2016. https://hal.inria.fr/tel-01427009
Degueule, T., Combemale, B., Blouin, A., Barais, O., Jézéquel, J.M.: Melange: a meta-language for modular and reusable development of dslsa meta-language for modular and reusable development of DSLs. In: Proceedings of 2015 ACM SIGPLAN International Conference on Software Language Engineering (SLE 2015), pp. 25–36. ACM (2015). https://doi.org/10.1145/2814251.2814252
Dejanović, I., Milosavljević, G., Vaderna, R.: Arpeggio: a flexible peg parser for python. Knowl.-Based Syst. 95, 71–74 (2016). https://doi.org/10.1016/j.knosys.2015.12.004
Diekmann, L., Tratt, L.: Eco: a language composition editor. In: Combemale, B., Pearce, D.J., Barais, O., Vinju, J.J. (eds.) SLE 2014. LNCS, vol. 8706, pp. 82–101. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-11245-9_5
Erdweg, S., Giarrusso, P.G., Rendel, T.: Language composition untangled. In: Proceedings of Twelfth Workshop on Language Descriptions, Tools, and Applications (LDTA 2012), pp. 7:1–7:8. ACM (2012). https://doi.org/10.1145/2427048.2427055
Erdweg, S., et al.: Evaluating and comparing language workbenches: Existing results and benchmarks for the future. Comput. Lang. Syst. Struct. 44(Part A), 24–47 (2015). https://doi.org/10.1016/j.cl.2015.08.007
Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In: Proceedings of 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL2004), pp. 111–122. ACM (2004). https://doi.org/10.1145/964001.964011
Fowler, M.: Domain Specific Languages. 1st edn. Addison-Wesley, Boston (2010)
Gamma, E., Helm, R., Johnson, R.E., Vlissides, J.: Design Patterns - Elements of Reusable Object-Oriented Software. Addison Wesley Professional Computing Series, Addison-Wesley, Boston, October 1995
Grimm, R.: Better extensibility through modular syntax. In: Proceedings of 27th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI 2006), pp. 38–51. ACM (2006). https://doi.org/10.1145/1133981.1133987
Grune, D., Jacobs, C.J.H.: Parsing Techniques. MCS, Springer, New York (2008). https://doi.org/10.1007/978-0-387-68954-8
Jézéquel, J.-M., Méndez-Acuña, D., Degueule, T., Combemale, B., Barais, O.: When systems engineering meets software language engineering. In: Boulanger, F., Krob, D., Morel, G., Roussel, J.-C. (eds.) Complex Systems Design & Management, pp. 1–13. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-11617-4_1
Johnstone, A., Scott, E., van den Brand, M.: Modular grammar specification. Sci. Comput. Program. 87, 23–43 (2014). https://doi.org/10.1016/j.scico.2013.09.012
Krahn, H., Rumpe, B., Völkel, S.: Monticore: a framework for compositional development of domain specific languages. Int. J. Softw. Tools. Technol. Transfer 12(5), 353–372 (2010). https://doi.org/10.1007/s10009-010-0142-1
Kühn, T., Cazzola, W., Olivares, D.M.: Choosy and picky: configuration of language product lines. In: Proceedings of 19th International Conference on Software Product Line (SPLC 2015), pp. 71–80. ACM (2015). https://doi.org/10.1145/2791060.2791092
Kuramitsu, K.: Nez: Practical open grammar language. In: Proceedings of 2016 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward! 2016), pp. 29–42. ACM (2016). https://doi.org/10.1145/2986012.2986019
Liebig, J., Daniel, R., Apel, S.: Feature-oriented language families: a case study. In: Proceedings of 7th International Workshop on Variability Modelling of Software-intensive Systems (VaMoS 2013), pp. 11:1–11:8. ACM (2013). https://doi.org/10.1145/2430502.2430518
Mascarenhas, F., Medeiros, S., Ierusalimschy, R.: On the relation between context-free grammars and parsing expression grammars. Sci. Comput. Program. 89, 235–250 (2014). https://doi.org/10.1016/j.scico.2014.01.012
Medeiros, S., Ierusalimschy, R.: A parsing machine for PEGs. In: Proceedings of 2008 Symposium on Dynamic Languages (DLS 2008), pp. 2:1–2:12. ACM (2008). https://doi.org/10.1145/1408681.1408683
Méndez-Acuña, D., Galindo, J.A., Degueule, T., Combemale, B., Baudry, B.: Leveraging software product lines engineering in the development of external DSLs: a systematic literature review. Comput. Lang. Syst. Struct. 46, 206–235 (2016). https://doi.org/10.1016/j.cl.2016.09.004
Meyers, B., Cicchetti, A., Guerra, E., de Lara, J.: Composing textual modelling languages in practice. In: Proceedings of 6th International Workshop on Multi-Paradigm Modeling (MPM 2012), pp. 31–36. ACM (2012). https://doi.org/10.1145/2508443.2508449
Parr, T.: Language Implementation Patterns: Create Your Own Domain-Specific and General Programming Languages. 1st edn. Pragmatic Bookshelf, Raleigh (2009)
Parr, T.: The Definitive ANTLR 4 Reference. 2nd edn. Pragmatic Bookshelf, Raleigh (2013)
Redziejowski, R.R.: Some aspects of parsing expression grammar. Fundamenta Informaticae 85(1–4), 441–454 (2008)
Servetto, M., Mackay, J., Potanin, A., Noble, J.: The billion-dollar fix. In: Castagna, G. (ed.) ECOOP 2013. LNCS, vol. 7920, pp. 205–229. Springer, Heidelberg (2013). https://doi.org/10.1007/978-3-642-39038-8_9
Simons, A.J.H.: The theory of classification, part 9: Inheritance and self reference. J. Object Technol. 2(6), 25–34 (2003)
Sobernig, S.: Variable Domain-specific Software Languages with DjDSL. Springer (2020). https://doi.org/10.1007/978-3-030-42152-6
Sobernig, S.: Object parsing grammars with composition. In: Proceedings of 16th International Conference on Software Technologies (ICSOFT’2021), pp. 373–385. SCITEPRESS (2021). https://doi.org/10.5220/0010558303730385
Sobernig, S., Zdun, U.: Inversion-of-control layer. In: Proceedings of 15th Annual European Conference on Pattern Languages of Programming (EuroPLoP 2010), ACM (2010). https://doi.org/10.1145/2328909.2328935
van der Storm, T., Cook, W.R., Loh, A.: The design and implementation of object grammars. Sci. Comput. Program. 96, 460–487 (2014). https://doi.org/10.1016/j.scico.2014.02.023
Visser, E.: Syntax Definition for Language Prototyping. Ph.D. thesis, University of Amsterdam (1997). http://eelcovisser.org/wiki/thesis
Voelter, M.: The design, evolution, and use of KernelF. In: Rensink, A., Sánchez Cuadrado, J. (eds.) ICMT 2018. LNCS, vol. 10888, pp. 3–55. Springer, Cham (2018). https://doi.org/10.1007/978-3-319-93317-7_1
Wille, D., Schulze, S., Schaefer, I.: Variability mining of state charts. In: Proceedings of 7th International Workshop on Feature-Oriented Software Development (FOSD 2016), pp. 63–73. ACM (2016). https://doi.org/10.1145/3001867.3001875
Zdun, U.: Language Support for Dynamic and Evolving Software Architectures. Doctoral thesis, University of Essen, January 2002
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2022 Springer Nature Switzerland AG
About this paper
Cite this paper
Sobernig, S. (2022). Object Parsing Expressions for Unplanned, Unmodified, and Incremental Grammar Reuse. In: Fill, HG., van Sinderen, M., Maciaszek, L.A. (eds) Software Technologies. ICSOFT 2021. Communications in Computer and Information Science, vol 1622. Springer, Cham. https://doi.org/10.1007/978-3-031-11513-4_2
Download citation
DOI: https://doi.org/10.1007/978-3-031-11513-4_2
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-031-11512-7
Online ISBN: 978-3-031-11513-4
eBook Packages: Computer ScienceComputer Science (R0)