在RFC 2141中解释NID的BNF语法(Explain BNF syntax for NID in RFC 2141)

系统教程 行业动态 更新时间:2024-06-14 16:57:18
在RFC 2141中解释NID的BNF语法(Explain BNF syntax for NID in RFC 2141)

我无法理解RFC2141的一些BNF语法。

该行是<NID> ::= <let-num> [ 1,31<let-num-hyp> ] 。 我认为这意味着<NID>是一个字符串的符号,受两条规则的约束:

该字符串必须以任何<let-num>字符的单个出现开始。 该字符后面可以跟随任何<let-num-hyp>字符的0-31次出现*。

我正确阅读这个吗? 因为,如果我是这样,其中一些含义有点令人困惑。

* 相当于“可选地发生1-31次

RFC2141中的<NID> (命名空间标识符)的完整BNF语法是:

<NID> ::= <let-num> [ 1,31<let-num-hyp> ] <let-num-hyp> ::= <upper> | <lower> | <number> | "-" <let-num> ::= <upper> | <lower> | <number> <upper> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" <lower> ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" <number> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

I am having trouble understanding some BNF syntax from RFC2141.

The line is <NID> ::= <let-num> [ 1,31<let-num-hyp> ]. I think it means that <NID> is a symbol for a string, with constrained by two rules:

The string must be begin with a single occurence of any of the <let-num> characters. This character may be followed by 0-31 occurrences* of any of the <let-num-hyp> characters.

Am I reading this correctly? Because, if I am, some of the implications are a bit confusing.

*equivalent to "optionally, 1-31 occurrences

The complete BNF syntax for a <NID> (Namespace Identifier) in RFC2141 is:

<NID> ::= <let-num> [ 1,31<let-num-hyp> ] <let-num-hyp> ::= <upper> | <lower> | <number> | "-" <let-num> ::= <upper> | <lower> | <number> <upper> ::= "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z" <lower> ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" <number> ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9"

最满意答案

你已经正确解释了它。 什么是令人困惑的影响?

<NID> ::= <let-num> [ 1,31<let-num-hyp> ]

意味着一次出现<let-num>可选地最多出现31次出现的<let-num-hyp> 。

考虑到其他定义,这意味着至少包含一个字符和至多32个字符的字符串,由字母,数字和连字符组成,第一个字符不允许为连字符。

You've interpreted it correctly. What are the confusing implications?

<NID> ::= <let-num> [ 1,31<let-num-hyp> ]

means one occurrence of <let-num> followed optionally by up to 31 occurrences of <let-num-hyp>.

Taking into account the other definitions, this means a string of at least one character and at most 32 characters, consisting of letters of either case, numerals, and hyphens, with the first character not allowed to be a hyphen.

更多推荐

本文发布于:2023-04-12 20:38:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/aa73e7d067e60d50ebf8f127f9011fe1.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:语法   NID   RFC   syntax   Explain

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!