[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: snmpconf proposed policy language grammar change



At 10:55 AM 4/16/2001 -0400, Ray Byler wrote:

>Since the policy language is formally defined as a
>subset of ISO C++, it should follow C/C++ rules of
>operator precedence.  The policy language grammar
>as written doesn't enforce this, and precedence
>rules in yacc/bison don't solve the problem.
>The simplest solution is to modify the grammar.
>Therefore, I recommend that we replace the following
>productions. The new rules are functionally
>equivalent, but enforce C's rules of operator precedence.

We once had the precedence spelled out in the grammar as you suggested. 
However, Steve felt that compactness was called for, so we went with the 
simpler BNF. There is nothing in the document that suggests that this BNF 
is a yacc grammar and there is no attempt to make it so.  The document 
explicitly states that the BNF is not sufficient in and of itself to 
describe the language. You must refer to the rules of C++ in order to 
complete the picture. Thus, he precedence rules of C++ apply even if they 
are not spelled out in the compact BNF used in the document.  The breakdown 
you suggest is exactly the kind of thing I would do in a real 
implementation (I have not checked your grammar for accuracy, BTW), but it 
is not necessary to express it this way in the Policy document.

BTW, this is the reason we removed the non-if-statement production: it is 
useful for getting a parser generator to work, but the rules of C++ are 
sufficient without using the abbreviated BNF as the arbiter of ambiguity.


- Pablo
---------------------------------------------------------------------
Pablo Halpern                                    phalpern@newview.org
http://www.halpernwightsoftware.com