Skip to main content

A Query Language forĀ Language Analysis

  • Conference paper
  • First Online:
Software Engineering and Formal Methods (SEFM 2022)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 13550))

Included in the following conference series:

Abstract

Language analysis aims at establishing properties of languages, which provides strong guarantees on the behavior of every program written in such languages. Tools that automate language analysis often need to browse a language definition given as input and retrieve information from grammars, typing rules, reduction rules, and other components of the language.

In this paper, we propose a languages-as-databases approach where language definitions are stored as database tables. Our main contribution is \(\textsc {Lang-Sql}\), a SQL-inspired query language that can express queries over languages. The key characteristic of \(\textsc {Lang-Sql}\) is that it contains linguistic features that are specific to query operational semantics aspects.

To demonstrate that \(\textsc {Lang-Sql}\) can be used in practical applications, we have used \(\textsc {Lang-Sql}\) queries to rewrite the majority of \(\textsc {Lang-n-Check}\), a tool that analyzes languages and establishes their type soundness. Our queries are declarative, and concisely express complicated operations.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 54.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 69.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

References

  1. Aceto, L., Goriac, E., IngĆ³lfsdĆ³ttir, A.: Meta SOS - a maude based SOS meta-theory framework. In: Borgstrƶm, J., Luttik, B. (eds.) Proceedings Combined 20th International Workshop on Expressiveness in Concurrency and 10th Workshop on Structural Operational Semantics, EXPRESS/SOS 2013, Buenos Aires, Argentina, 26th August 2013. EPTCS, vol. 120, pp. 93ā€“107 (2013). https://doi.org/10.4204/EPTCS.120.8

  2. Altenkirch, T., Reus, B.: Monadic presentations of lambda terms using generalized inductive types. In: Flum, J., Rodriguez-Artalejo, M. (eds.) CSL 1999. LNCS, vol. 1683, pp. 453ā€“468. Springer, Heidelberg (1999). https://doi.org/10.1007/3-540-48168-0_32

    ChapterĀ  Google ScholarĀ 

  3. van Antwerpen, H., Bach Poulsen, C., Rouvoet, A., Visser, E.: Scopes as types. Proc. ACM Program. Lang. (PACMPL) 2(OOPSLA), 1ā€“30 (2018). https://doi.org/10.1145/3276484

    ArticleĀ  Google ScholarĀ 

  4. Bach Poulsen, C., Rouvoet, A., Tolmach, A., Krebbers, R., Visser, E.: Intrinsically-typed definitional interpreters for imperative languages. Proc. ACM Program. Lang. (PACMPL) 2(POPL), 1ā€“34 (2017). https://doi.org/10.1145/3158104

    ArticleĀ  Google ScholarĀ 

  5. Bloom, B., Istrail, S., Meyer, A.R.: Bisimulation canā€™t be traced. J. ACM 42(1), 232ā€“268 (1995). https://doi.org/10.1145/200836.200876

    ArticleĀ  MathSciNetĀ  Google ScholarĀ 

  6. Cheney, J.: Toward a general theory of names: binding and scope. In: Pollack, R. (ed.) Proceedings of the 3rd ACM SIGPLAN Workshop on Mechanized Reasoning about Languages with Variable Binding, MERLIN 2005, pp. 33ā€“40. Association for Computing Machinery, New York (2005). https://doi.org/10.1145/1088454.1088459

  7. Cimini, M.: Lang-n-check. https://github.com/mcimini/TypeSoundnessCertifier (2015)

  8. Cimini, M.: Languages as first-class citizens (vision paper). In: Pearce, D.J., Mayerhofer, T., Steimann, F. (eds.) Proceedings of the 11th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2018, pp. 65ā€“69. Association for Computing Machinery, New York (2018). https://doi.org/10.1145/3276604.3276983

  9. Cimini, M.: On the effectiveness of higher-order logic programming in language-oriented programming. In: Nakano, K., Sagonas, K. (eds.) FLOPS 2020. LNCS, vol. 12073, pp. 106ā€“123. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-59025-3_7

    ChapterĀ  Google ScholarĀ 

  10. Cimini, M.: A calculus for multi-language operational semantics. In: Bloem, R., Dimitrova, R., Fan, C., Sharygina, N. (eds.) Software Verification. NSV VSTTE 2021 2021. Lecture Notes in Computer Science, vol. 13124, pp. 25ā€“42. Springer (2021). https://doi.org/10.1007/978-3-030-95561-8_3

  11. Cimini, M.: Example of language in lang-SQL. https://github.com/mcimini/lang-sql/blob/main/Lang-n-Check/languages/stlc_cbv.lan (2022)

  12. Cimini, M.: Lang-SQL. https://github.com/mcimini/lang-sql (2022)

  13. Cimini, M., Miller, D., Siek, J.G.: Extrinsically typed operational semantics for functional languages. In: LƤmmel, R., Tratt, L., de Lara, J. (eds.) Proceedings of the 13th ACM SIGPLAN International Conference on Software Language Engineering, SLE 2020, Virtual Event, USA, November 16ā€“17 2020, pp. 108ā€“125. ACM (2020). https://doi.org/10.1145/3426425.3426936

  14. Grewe, S., Erdweg, S., Mezini, M.: Using vampire in soundness proofs of type systems. In: KovĆ”cs, L., Voronkov, A. (eds.) Proceedings of the 1st and 2nd Vampire Workshops. EPiC Series in Computing, vol. 38, pp. 33ā€“51. EasyChair (2016). https://doi.org/10.29007/22x6

  15. Grewe, S., Erdweg, S., Mezini, M.: Automating proof steps of progress proofs: comparing vampire and Dafny. In: KovĆ”cs, L., Voronkov, A. (eds.) Vampire 2016. Proceedings of the 3rd Vampire Workshop. EPiC Series in Computing, vol. 44, pp. 33ā€“45. EasyChair (2017). https://doi.org/10.29007/5zjp

  16. Grewe, S., Erdweg, S., Wittmann, P., Mezini, M.: Type systems for the masses: deriving soundness proofs and efficient checkers. In: Murphy, G.C., Steele Jr., G.L. (eds.) 2015 ACM International Symposium on New Ideas, New Paradigms, and Reflections on Programming and Software (Onward!), pp. 137ā€“150. Onward! 2015, ACM, New York (2015). https://doi.org/10.1145/2814228.2814239

  17. Harper, R.: Practical Foundations for Programming Languages, 2nd edn. Cambridge University Press, Cambridge (2016). https://doi.org/10.1017/CBO9781316576892

    BookĀ  Google ScholarĀ 

  18. Mousavi, M.R., Reniers, M.A.: Prototyping SOS meta-theory in Maude. Electron. Notes . Theor. Comput. Sci. 156(1), 135ā€“150 (2006). https://doi.org/10.1016/j.entcs.2005.09.030

    ArticleĀ  Google ScholarĀ 

  19. Mousavi, M.R., Reniers, M.A., Groote, J.F.: SOS formats and meta-theory: 20 years after. Theor. Comput. Sci. 373(3), 238ā€“272 (2007). https://doi.org/10.1016/j.tcs.2006.12.019

    ArticleĀ  MathSciNetĀ  Google ScholarĀ 

  20. Neron, P., Tolmach, A., Visser, E., Wachsmuth, G.: A theory of name resolution. In: Vitek, J. (ed.) ESOP 2015. LNCS, vol. 9032, pp. 205ā€“231. Springer, Heidelberg (2015). https://doi.org/10.1007/978-3-662-46669-8_9

    ChapterĀ  Google ScholarĀ 

  21. Roberson, M., Harries, M., Darga, P.T., Boyapati, C.: Efficient software model checking of soundness of type systems. In: Harris, G.E. (ed.) Proceedings of the 23rd ACM SIGPLAN Conference on Object-Oriented Programming Systems Languages and Applications, pp. 493ā€“504. OOPSLA 2008, Association for Computing Machinery, New York (2008). https://doi.org/10.1145/1449764.1449803

  22. Rouvoet, A., Bach Poulsen, C., Krebbers, R., Visser, E.: Intrinsically-typed definitional interpreters for linear, session-typed languages. In: Blanchette, J., Hritcu, C. (eds.) Proceedings of the 9th ACM SIGPLAN International Conference on Certified Programs and Proofs, CPP 2020, New Orleans, LA, USA, January 20ā€“21 2020, pp. 284ā€“298. ACM (2020). https://doi.org/10.1145/3372885.3373818

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Matteo Cimini .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

Ā© 2022 The Author(s), under exclusive license to Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Cimini, M. (2022). A Query Language forĀ Language Analysis. In: Schlingloff, BH., Chai, M. (eds) Software Engineering and Formal Methods. SEFM 2022. Lecture Notes in Computer Science, vol 13550. Springer, Cham. https://doi.org/10.1007/978-3-031-17108-6_4

Download citation

  • DOI: https://doi.org/10.1007/978-3-031-17108-6_4

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-031-17107-9

  • Online ISBN: 978-3-031-17108-6

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics