Skip to main content

BNF-Style Notation as It Is Actually Used

  • Conference paper
  • First Online:
Intelligent Computer Mathematics (CICM 2019)

Part of the book series: Lecture Notes in Computer Science ((LNAI,volume 11617))

Included in the following conference series:

Abstract

The famous BNF grammar notation, as introduced and used in the Algol 60 report, was subsequently followed by numerous notational variants (EBNF, ABNF, RBNF, etc.), and later by a new formal “grammars” metalanguage used for discussing structured objects in Computer Science and Mathematical Logic. We refer to this latter offspring of BNF as MBNF (Math-BNF), and to aspects common to MBNF, BNF, and its notational variants as BNF-style. MBNF is sometimes called “abstract syntax”, but we avoid that name because MBNF is in fact a concrete form and there is a more abstract form. What all BNF-style notations share is the use of production rules like (P) below which state that “every instance of \(\circ _i\) for \(i \in \{1,...,n\}\) is also an instance of \(\bullet \)”.

However, MBNF is distinct from all variants of BNF in the entities and operations it allows. Instead of strings, MBNF builds arrangements of symbols that we call math-text and allows “syntax” to be built by interleaving MBNF production rules and other mathematical definitions that can contain chunks of math-text. The differences between BNF (or its variant forms) and MBNF have not been clearly presented before. (There is also no clear definition of MBNF anywhere but this is beyond the scope of this paper.)

This paper reviews BNF and some of its variant forms as well as MBNF, highlighting the differences between BNF (including its variant forms) and MBNF. We show via a series of detailed examples that MBNF, while superficially similar to BNF, differs substantially from BNF and its variants in how it is written, the operations it allows, and the sets of entities it defines. We also argue that the entities MBNF handles may extend far outside the scope of rewriting relations on strings and syntax trees derived from such rewriting sequences, which are often used to express the meaning of BNF and its notational variants.

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

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.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

Notes

  1. 1.

    For example, consider an abstract syntax tree (AST) representing \(\lambda x.e\). An AST is a tree where each branch goes to a syntactic evaluation of a metavariable and each node is either a metavariable assignment which contains no further evaluations or a function taking metavariables, which represents an evaluation. In an AST for \(\lambda x.e\), we would not be interested that the x and the e are arranged with a dot between them and a \(\lambda \) in front of them. Rather, would just be a name for aparticular function taking two arguments of an appropriate type.

  2. 2.

    We chose ESOP 2012, but we could equally pick any other conferences. Because the first book we picked contained an abundance of challenging instances of MBNF, our wider searching has mainly been to find even more challenging examples. We will be happy to receive pointers to additional interesting cases. We also checked the POPL 2017 proceedings [11] and found that out of 46 papers using BNF-style notation, not one used notation exactly corresponding to the EBNF [20], ABNF [6] or RBNF [10] standards and only one [16] could possibly be thought of as EBNF or ABNF with variant syntax. Out of the other 45 POPL 2017 papers featuring BNF-style notation, 44 use what we call MBNF.

  3. 3.

    Here a metavariable is a variable at the meta-level which denotes something at an object-level.

  4. 4.

    www.cl.cam.ac.uk/~sd601/mlsub/.

  5. 5.

    The root node is on the spine. If A is applied to B by an application on the spine, the root node of A is on the spine and the root node of B is not. If a node on the spine is an abstraction each of its children is on the spine (i.e., every node appearing on the furthest left hand side of the tree is on the spine).

  6. 6.

    A balanced segment is one where each application has a matching abstraction and where each application/abstraction pair contains a balanced segment.

  7. 7.

    Actually a slightly weaker condition than the one we give here is probably sufficient for the Barendregt convention to hold, but it would be more complicated to state.

  8. 8.

    As previously noted we avoid that name, because MBNF is a concrete form.

References

  1. Backus, J.W.: The syntax and semantics of the proposed international algebraic language of the Zurich ACM-GAMM conference. In: IFIP Congress (1959). https://dblp.uni-trier.de/db/conf/ifip/ifip1959.html

  2. Backus, J.W., et al.: Revised report on the algorithm language ALGOL 60. Commun. ACM 6(1), 1–17 (1963)

    Article  Google Scholar 

  3. Berstel, J., Lauve, A., Reutenauer, C., Saliola, F.V.: Combinatorics on Words. Christoffel Words and Repetitions in Words. American Mathematical Society (AMS), Providence (2009)

    MATH  Google Scholar 

  4. Chang, S., Felleisen, M.: The call-by-need lambda calculus, revisited. In: Seidl [30]

    Google Scholar 

  5. Chomsky, N.: Three models for the description of language. IRE Trans. Inf. Theory 2(3), 113–124 (1956)

    Article  Google Scholar 

  6. Crocker, D., Overell, P. (ed.): Augmented BNF for syntax specifications: ABNF. Internet Requests for Comments (2008). http://www.rfc-editor.org/info/rfc5234

  7. Dolan, S., Mycroft, A.: Polymorphism, subtyping, and type inference in MLsub. In: Fluet [11]

    Google Scholar 

  8. Eberhart, C., Hirschowitz, T., Seiller, T.: An intensionally fully-abstract sheaf model for \(\pi ^\ast \). In: Moss, L.S., Sobocinski, P., (eds.) 6th Conference on Algebra and Coalgebra in Computer Science (CALCO 2015), vol. 35 of Leibniz International Proceedings in Informatics (LIPIcs), Dagstuhl, Germany (2015). Schloss Dagstuhl-Leibniz-Zentrum fuer Informatik

    Google Scholar 

  9. Farmer, W.M.: The formalization of syntax-based mathematical algorithms using quotation and evaluation. CoRR, abs/1305.6052 (2013). http://arxiv.org/abs/1305.6052

  10. Farrel, A.: Routing Backus-Naur form (RBNF): A syntax used to form encoding rules in various routing protocol specifications. RFC 5511, RFC Editor (2009). https://tools.ietf.org/html/rfc5511

  11. Fluet, M., (ed.): POPL 2017: Proceedings of the 44th ACM SIGPLAN Symposium on Principles of Programming Languages. ACM, New York (2017)

    Google Scholar 

  12. Ford, B.: Parsing expression grammars: a recognition-based syntactic foundation. In Proceedings of the 31st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2004, ACM, New York (2004). http://doi.acm.org/10.1145/964001.964011

  13. Forsberg, M., Ranta, A.: The labelled BNF grammar formalism (2005)

    Google Scholar 

  14. Germane, K., Might, M.: A posteriori environment analysis with pushdown delta CFA. In: Fluet [11]

    Google Scholar 

  15. Grewe, S., Erdweg, S., Pacak, A., Raulf, M., Mezini, M.: Exploration of language specifications by compilation to first-order logic. Sci. Comput. Program. 155, 146–172 (2018)

    Article  Google Scholar 

  16. Grigore, R.: Java generics are turing complete. In: Fluet [11]

    Google Scholar 

  17. Hopcroft, J.E., Motwani, R., Ullman, J.D.: Introduction to Automata Theory, Languages, and Computation, 3rd edn. Addison-Wesley Longman Publishing Co., Inc., Boston (2006)

    MATH  Google Scholar 

  18. Inoue, J., Taha, W.: Reasoning about multi-stage programs. In: Seidl [30]

    Google Scholar 

  19. Ion, P.D.F., Poppelier, N., Carlisle, D., Miner, R.R.: Mathematical markup language (MathML) version 2.0. W3C recommendation, W3C (2001). https://www.w3.org/TR/MathML2/chapter3.html

  20. ISO: Information technology - Syntactic metalanguage - Extended BNF. Standard, International Organization for Standardization, Geneva, CH (1996)

    Google Scholar 

  21. ISO: Information technology - Open Document Format for Office Applications (OpenDocument) v1.2 - Part 1: OpenDocument Schema. Standard, International Organization for Standardization, Geneva, CH (2015)

    Google Scholar 

  22. Knuth, D.E.: The TeXbook. Addison-Wesley Professional, Boston (1986)

    Google Scholar 

  23. Llana Díaz, L.F., Núñez, M.: Testing semantics for unbounded nondeterminism. In: Lengauer, C., Griebl, M., Gorlatch, S. (eds.) Euro-Par 1997. LNCS, vol. 1300, pp. 538–545. Springer, Heidelberg (1997). https://doi.org/10.1007/BFb0002780

    Chapter  Google Scholar 

  24. Mann, P.B.: A translational BNF grammar notation (TBNF). SIGPLAN Not. 41(4), 16–23 (2006)

    Article  Google Scholar 

  25. Milner, R., Parrow, J., Walker, D.: A calculus of mobile processes, i. Inf. Comput. 100(1), 1–40 (1992). https://doi.org/10.1016/0890-5401(92)90008-4

    Article  MathSciNet  MATH  Google Scholar 

  26. Pfenning, F., Elliott, C.: Higher-order abstract syntax. In: Proceedings of the ACM SIGPLAN 1988 Conference on Programming Language Design and Implementation, PLDI 1988. ACM, New York (1988) https://doi.org/10.1145/53990.54010

  27. Pierce, B.C.: Types and Programming Languages, 1st edn. The MIT Press, Cambridge (2002)

    MATH  Google Scholar 

  28. Ranta, A.: Grammatical framework. J. Funct. Program. 14(2), 145–189 (2004). https://doi.org/10.1017/S0956796803004738

    Article  MathSciNet  MATH  Google Scholar 

  29. Reynolds, J.C.: Theories of Programming Languages, 1st edn. Cambridge University Press, New York (2009)

    MATH  Google Scholar 

  30. Seidl, H. (ed.): Programming Languages and Systems. Springer, Heidelberg (2012)

    MATH  Google Scholar 

  31. Sewell, P., et al.: Ott: effective tool support for the working semanticist. SIGPLAN Not. 42(9), 1–12 (2007)

    Article  Google Scholar 

  32. Steele Jr., G.L.: It’s time for a new old language. In: Proceedings of the 22nd ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPoPP 2017. ACM, New York (2017)

    Google Scholar 

  33. Tobisawa, K.: A meta lambda calculus with cross-level computation. In: POPL 2015 (2015)

    Google Scholar 

  34. Toronto, N., McCarthy, J.: Computing in Cantor’s paradise with \({\uplambda }_{\rm ZFC}\). In: Schrijvers, T., Thiemann, P. (eds.) FLOPS 2012. LNCS, vol. 7294, pp. 290–306. Springer, Heidelberg (2012). https://doi.org/10.1007/978-3-642-29822-6_23

    Chapter  Google Scholar 

  35. Zaytsev, V.: The grammar hammer of 2012. CoRR, abs/1212.4446 (2012). https://arxiv.org/abs/1212.4446

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Fairouz Kamareddine .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2019 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Quinlan, D., Wells, J.B., Kamareddine, F. (2019). BNF-Style Notation as It Is Actually Used. In: Kaliszyk, C., Brady, E., Kohlhase, A., Sacerdoti Coen, C. (eds) Intelligent Computer Mathematics. CICM 2019. Lecture Notes in Computer Science(), vol 11617. Springer, Cham. https://doi.org/10.1007/978-3-030-23250-4_13

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-23250-4_13

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-23249-8

  • Online ISBN: 978-3-030-23250-4

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics