Hi Martin,

I was looking at the YANG ABNF grammar a bit more last night (to see how hard it would be to write a parser for it) and I had a couple more observations. Apologies that this is after the WG last call ...

1. [Trivial] The indentation of the range statement in 9.3.5 looks wrong.

9.3.5. Usage Example

     typedef my-decimal {
       type decimal64 {
         fraction-digits 2;
           range "1 .. 3.14 | 10 | 20..max";
       }
     }


I presume that it should be:

9.3.5. Usage Example

     typedef my-decimal {
       type decimal64 {
         fraction-digits 2;
         range "1 .. 3.14 | 10 | 20..max";
       }
     }



2. The description of yang-char (around page 186) doesn't seem to be quite accurate (relative to description of legal characters in 6. YANG Syntax), and given that it excludes character values outside the unicode range.

   ;; any Unicode character including tab, carriage return, and line
   ;; feed, but excluding the other C0 control characters, the surrogate
   ;; blocks, and the noncharacters.
   yang-char = %x9 / %xA / %xD / %x20-D7FF /
   ...


Should this be:

   ;; any Unicode or IOS/IEC 10646 character including tab, carriage return, 
and line
   ;; feed, but excluding the other C0 control characters, the surrogate
   ;; blocks, and the noncharacters.
   yang-char = %x9 / %xA / %xD / %x20-D7FF /



3. There are lots of comments where "these stmts can appear in any order", e.g.

   linkageStmts       = ;; these stmts can appear in any order
                         *importStmt
                         *includeStmt

Am I right in interpreting that there can be any number of import and include statements and they can be interleaved in any arbitrary order? E.g. this specific example (but not in the general case) could equally have been written *(importStmt / includeStmt).

Thanks,
Rob


On 13/10/2015 11:17, Martin Bjorklund wrote:
Robert Wilton <rwil...@cisco.com> wrote:
Hi,

I was looking the Yang 1.1 ABNF Grammar, and noticed various places
where the rules are specified as the directive "a string that matches
the rule XXX", e.g.

    yang-version-arg-str = < a string that matches the rule
                            yang-version-arg >

    yang-version-arg    = "1"


It was slightly unclear to me exactly what is meant by this.

Am I right in understanding that the only valid text that would match
yang-version-arg-str would be the 3 character sequence *"1"*
No.

or is it
more nuanced that this?
Yes.

First of all the abnf-rule

   yang-version-arg = "1"

matches a single character 1 (not three characters).

Next, YANG has a very regular syntax that all statements follow:

      statement = keyword [argument] (";" / "{" *statement "}")

The argument in this rule is a string.  A string in YANG can be
specified in several ways:

    unqouted, e.g.:    foo
    quoted, e.g.:      'foo' or "foo"
    concatenated, e.g: "f" + "oo"

This cannot be expressed directly in ABNF.  So when the YANG grammar
says "a string that matches the rule..." it means that the "expanded"
string matches the rule.

So e.g., this is all legal:

     config false;
     config "false";
     config 'f' + "alse";


/martin
.


_______________________________________________
netmod mailing list
netmod@ietf.org
https://www.ietf.org/mailman/listinfo/netmod

Reply via email to