# EBNF dialect used in the Racket docs

**URL:** https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821
**Category:** Questions & Answers
**Created:** [March 22, 2024, 5:44pm UTC](https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821 "2024-03-22T17:44:38Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![Tyrn](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/tyrn/32/1731_2.png) [@Tyrn](https://racket.discourse.group/u/Tyrn)
#### Post date: [March 22, 2024, 5:44pm UTC](https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821/1 "2024-03-22T17:44:38Z")

</div>

Hi,

Is there somewhere a description of the subj?

---

<div class="post-metadata">

### Author: ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)
#### Post date: [March 22, 2024, 5:50pm UTC](https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821/2 "2024-03-22T17:50:58Z")

</div>

The documentation search-bar is your friend, if I understood the question correctly:  
[scribble/bnf](https://docs.racket-lang.org/scribble/bnf.html)

Edit, clarification:

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/a/a7277cc7c6dbbe8af35fa9528ba36958703669d0.png)

---

<div class="post-metadata">

### Author: ![Tyrn](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/tyrn/32/1731_2.png) [@Tyrn](https://racket.discourse.group/u/Tyrn)
#### Post date: [March 22, 2024, 5:59pm UTC](https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821/3 "2024-03-22T17:59:50Z")

</div>

I've seen this. It's a utility package, but I want just a formal definition of the grammar notation used throughout the docs. It should be one of the first entries in the Reference, but I can't see it.

---

<div class="post-metadata">

### Author: ![benknoble](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/benknoble/32/16_2.png) [@benknoble](https://racket.discourse.group/u/benknoble)
#### Post date: [March 22, 2024, 6:13pm UTC](https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821/4 "2024-03-22T18:13:18Z")

</div>

It might be in "Notation for Documentation" [https://docs.racket-lang.org/reference/notation.html](https://docs.racket-lang.org/reference/notation.html)

---

<div class="post-metadata">

### Author: ![bakgatviooldoos](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/bakgatviooldoos/32/1381_2.png) [@bakgatviooldoos](https://racket.discourse.group/u/bakgatviooldoos)
#### Post date: [March 22, 2024, 6:13pm UTC](https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821/5 "2024-03-22T18:13:58Z")

</div>

Okay, I see, I jumped the shark.

I'm not sure, but `racketgrammar` might be a pointer in the right direction if I am reading the tea-leaves properly:

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/3/326c9a4fda06eb294d11a1d91e0fde3d6bfdfc86.png)

[from github](https://github.com/racket/racket/blob/4c490dcf16dfadac7bf896d59115e4412965f281/pkgs/racket-doc/scribblings/raco/info.scrbl#L35)

 ![image](https://global.discourse-cdn.com/free1/uploads/racket/original/2X/d/d99b39d7c817393ec33265d9d549f8b5566b5c86.png)

---

<div class="post-metadata">

### Author: ![EmEf](https://avatars.discourse-cdn.com/v4/letter/e/53a042/32.png) [@EmEf](https://racket.discourse.group/u/EmEf)
#### Post date: [March 22, 2024, 7:11pm UTC](https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821/6 "2024-03-22T19:11:17Z")

</div>

Extended BNF is loosely defined, derived from Backus-Naur Form ([https://en.wikipedia.org/wiki/Backus%E2%80%93Naur\_form](https://en.wikipedia.org/wiki/Backus%E2%80%93Naur_form)). While a Wikipedia entry exists for EBNF ([https://en.wikipedia.org/wiki/Extended\_Backus%E2%80%93Naur\_form](https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form)), you will find many authors using slightly different variants.

[[ In essence, a BNF definition is merely a CS reinvention of inductive definitions. For example, you may see expressions defined like this:

e = n | (+ e e) | (\* e e)  
n is a natural number

which denotes

e is either  
— a natural number,  
— a sequence of the tokens “(“, “+”, followed by two e and the token “)”  
— a sequence of the tokens “(“, “\*”, followed by two e and the token “)”  
and nothing else. (This is an important, often omitted part.)

A mathematician or a logician will recognize this as a system of two equations over sets to be solved in e and n. The solution we usually use is the least fix point in the lattice of all sets that extend `n` appropriately. ]]

---

<div class="post-metadata">

### Author: ![Tyrn](https://yyz2.discourse-cdn.com/free1/user_avatar/racket.discourse.group/tyrn/32/1731_2.png) [@Tyrn](https://racket.discourse.group/u/Tyrn)
#### Post date: [March 23, 2024, 6:09am UTC](https://racket.discourse.group/t/ebnf-dialect-used-in-the-racket-docs/2821/7 "2024-03-23T06:09:18Z")

</div>

This is an answer to a slightly different question 😊 .

1. With this (taken from a book on LLVM) I feel right at home. Good ol' Wirth, only he used `=` instead of `:`, `[]` instead of `()?`, `{}` instead of `()*`, and `.` instead of `;`. Also Wirth used `a{a}` instead of `()+`. I don't have to consult any appendices to get it. Nonetheless, they devote a whole paragraph to explain the following:

```scheme
calc : ("with" ident ("," ident)* ":")? expr ;
expr : term (( "+" | "-" ) term)* ;
term : factor (( "*" | "/") factor)* ;
factor : ident | number | "(" expr ")" ;
ident : ([a-zAZ])+ ;
number : ([0-9])+ ;

```

1. On the other hand, I feel a bit uncomfortable when I see `...` vs `...+`, wonder whether this or that is a grammar identifier or a keyword, or have to guess whether those parentheses are literal or belong to the EBNF notation. There should be a page with an exhaustive definition of the notation used throughout the docs.

Yes, the link above ([2&nbsp;Notation for Documentation](https://docs.racket-lang.org/reference/notation.html)) is the answer we have.
