Subject: Re: [netmod] Yang 1.0/1.1 ABNF Grammar: <a string that matches the rule ...>

From: Randy Presuhn <[email-masked]>
Date: Fri, 23 Oct 2015 09:15:26 -0700 (GMT-07:00)

Hi -

>From: Martin Bjorklund <[email-masked]>
>Sent: Oct 23, 2015 12:24 AM
>To: [email-masked]
>Cc: [email-masked]
>Subject: Re: [netmod] Yang 1.0/1.1 ABNF Grammar: <a string that matches the rule ...>
>
>Randy Presuhn <[email-masked]> wrote:
>> Hi -
>> 
>> >From: Martin Bjorklund <[email-masked]>
>> >Sent: Oct 22, 2015 6:20 AM
>> >To: [email-masked]
>> >Cc: [email-masked]
>> >Subject: Re: [netmod] Yang 1.0/1.1 ABNF Grammar: <a string that matches the rule ...>
>> ...
>> >> > 2. Similarly for import-stmt.  Should this have a comment indicating that prefix-stmt or revision-date-stmt can appear in any order?
>> >> > 
>> >> >   import-stmt         = import-keyword sep identifier-arg-str optsep
>> >> >                         "{" stmtsep
>> >> >                             prefix-stmt
>> >> >                             [revision-date-stmt]
>> >> >                         "}" stmtsep
>> >> 
>> >> Here it IMO makes little sense to require fixed order.
>> >
>> >Correct.  I have added the comment to this statement as well.
>> 
>> Just trying to understand... what problem is solved by
>> making the grammar more complex here?
>
>Do you mean for this particular statement?  The idea is that we
>shouldn't mandate an order among statements unless there is some
>reason for doing so.  Almost all statements are unordered, and it was
>simply a bug that we missed this one.

Yes, for this particular statement.  It doesn't make sense to
me to change a grammar, particularly if the change increases
complexity, unless there was an actual problem with the old
grammar.

(I personally prefer grammars that *don't* allow a lot of flexibility
in order.  They allow the person using the grammar to read (and write!)
things as though going through a checklist.  When the order of a bunch of
optional things can vary, it's harder to notice if something important
is missing or duplicated.   ----   but that's just a personal preference.)

Randy

---

From: Andy Bierman <[email-masked]>
Date: Fri, 23 Oct 2015 09:40:04 -0700

On Fri, Oct 23, 2015 at 9:15 AM, Randy Presuhn <[email-masked]
> wrote:

> >> >> > 2. Similarly for import-stmt.  Should this have a comment
> indicating that prefix-stmt or revision-date-stmt can appear in any order?
> >> >> >
We implemented this statement so the sub-statements can appear in any order.
Except for the header data (like import-stmt) there are no requirements
on the user to memorize any statement order.  We publish RFCs
in canonical order but that is not required for all modules.

YANG is supposed to be hardest on the tool writers (and it is!)
Lots of forward references and processing order complexity for
YANG compilers, but not the readers or writers.  The compiler
can figure out the checklist (e.g. pyang --ietf)

> is missing or duplicated.   ----   but that's just a personal preference.)
I think YANG is gaining popularity because it doesn't take a lot
of training to get started.  People can focus on getting the data model
right, instead of getting the data modeling language syntax right.

Randy

Andy

>
> _______________________________________________
> netmod mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/netmod
>

---

From: Robert Wilton <[email-masked]>
Date: Fri, 23 Oct 2015 17:40:59 +0100

Hi Randy,

> complexity, unless there was an actual problem with the old
Without the additional comment the grammar is inconsistent with many 
other sections of the YANG ABNF that allow statements to be in any 
order.  It is that inconsistency that I was raising, and that Martin has 
fixed.
> is missing or duplicated.   ----   but that's just a personal preference.)
Yes, certainly the grammar would be easier to implement if the order was 
fixed, but this isn't what is specified today and I can't really see 
this changing.

I think that what we have ended up with is:
  - all IETF YANG modules are required to be in canonical order.  I 
would imagine that other SDOs would follow suit.
  - all YANG parsers are required to be flexible in the order of the 
fields that they accept (although presumably the modules could be piped 
through pyang --yang-canonical to convert them to canonical order before 
being parsed by a more strict parser).

Thanks,
Rob

> .

---

From: Ladislav Lhotka <[email-masked]>
Date: Fri, 23 Oct 2015 19:26:44 +0200

> On 23 Oct 2015, at 18:40, Robert Wilton <[email-masked]> wrote:
> 
> Hi Randy,
> 
> Without the additional comment the grammar is inconsistent with many other sections of the YANG ABNF that allow statements to be in any order.  It is that inconsistency that I was raising, and that Martin has fixed.
>> 
> Yes, certainly the grammar would be easier to implement if the order was fixed, but this isn't what is specified today and I can't really see this changing.

Arbitrary order is easier for module writers - the canonical order is an extra thing to memorize.

Lada

> - all IETF YANG modules are required to be in canonical order.  I would imagine that other SDOs would follow suit.
> - all YANG parsers are required to be flexible in the order of the fields that they accept (although presumably the modules could be piped through pyang --yang-canonical to convert them to canonical order before being parsed by a more strict parser).
> 
> Thanks,
> Rob
> 
> 
>> 
>> Randy
>> 

--
Ladislav Lhotka, CZ.NIC Labs
PGP Key ID: E74E8C0C