Search code examples
notation

What is the notation I'm using called?


What is the notation that I've seen in IBM manuals and other places (sample below) called?

[Mr.|Ol’] Slome[{r|Dog|Dawg}] 

[] means "optional"

| means "choose one"

{} means "not optional"

So the above sample allows: Mr. Slomer Ol' Slome SlomeDawg Mr. SlomeDog and a few others.

I thought it was a form of Backus-Naur until I Googled that and became confused.

(I ask because I intend to enable input using those symbols [among others], parse it, and do whatever the user is requesting. So while it isn't strictly a programming question, it's related to a programming concept that I intend to implement. If still illegal, fine; delete it.)


Solution

  • It could be one of the different variants of the BNF, in particular is a variant called Extended Backus-Naur Form. In this form, however, {} means repetition.