DSlomer64
DSlomer64

Reputation: 4283

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.)

Upvotes: 1

Views: 48

Answers (2)

DSlomer64
DSlomer64

Reputation: 4283

Excerpted from IBM PL/I for MVS & VM Programming Guide Release 1.1:

How to Read the Notational Symbols
Some of the programming syntax in this book is presented using notational
symbols. This is to maintain consistency with descriptions of the same syntax in
other IBM publications, or to allow the syntax to be shown on single lines within a
table or heading.
 Braces, { }, indicate a choice of entry. Unless an item is underlined, indicating
a default, or the items are enclosed in brackets, you must choose at least one
of the entries.
 Items separated by a single vertical bar, |, are alternative items. You can
select only one of the group of items separated by single vertical bars. (Double
vertical bars, ||, specify a concatenation operation, not alternative items. See
the PL/I for MVS & VM Language Reference for more information on double
vertical bars.)
 Anything enclosed in brackets, [ ], is optional. If the items are vertically
stacked within the brackets, you can specify only one item.

It goes on. Maybe the "name" is "IBM notational symbol syntax". It worked for me back then, and now.

Upvotes: 1

Renzo
Renzo

Reputation: 27414

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.

Upvotes: 1

Related Questions