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

snmpconf BNF errors in policy MIB

This post is NOT part of my series addressing general language issues. This 
message is intended to address specific errors I found in the language as 
specified in the BNF.

First, the BNF in the document is far from complete. The text implies that 
the BNF is a subset of the language and that the rest of the language is 
supplied by the ANSI/ISO C standard. It does not make it clear exactly how 
the subset described is intended to mesh with the rest of C. Since the 
subset in question is less than 1/3 of the C standard, I suggest that we 
specify the ENTIRE language in BNF, rather than trying to describe deltas 
from the C standard. The entire C syntax is only about 10 pages of BNF, so 
our mini-C could be described in 3 or 4 pages at most. I'm willing to do 
this work, if desired. I can even run it through YACC to ensure that it is 
complete and unambiguous. (Steve Waldbusser: want to give me a crack at it?)

Even if we don't describe the entire language in BNF, there are important 
errors in the existing syntax. I don't have time to list every detail, but 
here are some highlights:

1. The language depends on char*, yet there is no way to declare a variable 
of type char*.

2. The syntax allows constructs like

         if (while(for( i = 0; i < 10; ++i) ; ))) j = if (i > 9) x = 5;

    In other words, an expression is allowed to have loops and 
if-conditionals in it. This is not C (although it is valid in other 
languages, including Perl). If we do want to allow such things (useful, but 
very not-C), we must describe the semantics.

3. There is no switch statement. Don't we want a switch statement? I think 
we do.

Again, I'm willing to take a crack at tightening this up, but I don't want 
to overlap with someone else's work or step on anybody's toes.

- Pablo
Pablo Halpern                                    phalpern@newview.org