[ntp:hackers] new config parsing code

Sachin Kamboj skamboj at gmail.com
Wed Apr 25 21:26:26 PDT 2007


Danny,

Basically I'd have to work quite hard to find these tools for Windows.


Bison *is* available with cygwin. There is also a standalone port of bison
on windows that does not require cygwin. So bison is cross platform and
readily available.

Besides you only need it if you decide to change keywords or the
configuration grammar. For everything else, you can use the generated files.

> I
> did have something for yacc on VMS at one time but requiring these kinds
> of tools stinks these days.


My rule is to always use the best tool for the job. I could have written a
parser by hand, but that would have been only marginally better than the
existing configuration code and perhaps not even that. It would still
require a lot of effort to make changes to the configuration code.
Alternatively, I could have written a completely new and improved parser
generator but that would be reinventing the wheel for very little gain.

Instead I chose to use a mature and commonly used tool that's perfect for
the purpose of parsing configuration code.

Years ago this was the common tool for
> parsers but if you want a language that runs on almost everything, I
> would have chosen perl.


To the best of my knowledge perl does not have a built in tool for creating
LR parsers. There are perl packages that you can download for building
parsers. However (a) few, if any, computers are likely to have these
packages installed by default and (b) bison is much more mature than
anything that might be available with perl.

Also I would rather stay away from the horrible kludge of a programming
language that perl is :-)

This is okay for a student project but we are
> way beyond that and it needs to be something that can be easily
> supported and easily modifiable.


 We will not be modifying or supporting bison in any way. We will only be
supporting the generating parser and I am sure I can vouch for that. One of
my aims in rewriting the configuration code has been to separate the
building of the parse tree from the actual configuration of ntp daemon
itself. Hence, the parser should be easy to modify/change and support if
needed since most of the support will not involve making any changes to the
parsing code.

I don't like the choice but then nobody
> asked me.


Well, what would you rather have me use?  I am sure it won't be too much
effort to convert the code from using bison to whatever tool you might like
to use since it would only require modifying a context-free grammar.

Regards,
Sachin.
-- 
___________________________________
Sachin Kamboj
Computer & Information Sciences
University of Delaware
Homepage: http://www.cis.udel.edu/~kamboj/
___________________________________


More information about the hackers mailing list