我使用的符号是什么?

时间:2015-07-18 16:33:58

标签: notation

我在IBM手册和其他地方(下面的示例)中看到的符号是什么?

|

{}表示"可选"

auto表示"选择一个"

'[^\d]*([0-9.]+%)' 表示"不是可选的"

所以上面的例子允许: 斯洛默先生 OL' Slome SlomeDawg SlomeDog先生 还有其他几个。

我认为这是Backus-Naur的一种形式,直到我用Google搜索并变得困惑。

(我问,因为我打算使用这些符号[等]启用输入,解析它,并做任何用户请求的事情。所以虽然它不是一个严格的编程问题,但它是&#39 ; s与我打算实现的编程概念有关。如果仍然非法,那么;删除它。)

2 个答案:

答案 0 :(得分:1)

它可能是BNF的不同变体之一,特别是名为Extended Backus-Naur Form的变体。 但是,在这种形式中,{}表示重复。

答案 1 :(得分:1)

摘自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.

继续。也许“名称”是“IBM符号符号语法”。那时它对我有用,现在。