On Saturday 12 March 2005 19:14, Manuel Woelker wrote:
> Therefore, the following question:
> Are there any projects going on converning a c++ yaml parser library?
> (I heard rumours about libyaml - is it still alive? Or are there
> plans for a C++ interface for the syck parser?)
I have began work on a C based parser that implements the full YAML 1.1
spec. While it does not provide a direct C++ interface, it does offer
an "OO-like" C interface and it should be "easy" to wrap it in a nice
(and very efficient) C++ wrapper.
The reason for using C rather than C++ is that C is more portable in
three ways. First, it requires a lot less run-time support, which is
important for embedded systems. Second, it is available on more
architectures, though admittedly this gap has grown narrower in the
last decade. Finally and most importantly, C "plays nice" with every
other programming platform. In many cases, simply wrapping it in a
dynamically linked library is enough. It is also "easy" to create an
efficient wrapper for it interfacing with
Java/Perl/Python/Tcl/Ruby/Fortran/Whatever. In contrast, C++ requires a
rather large standard library, C++ dynamically linked libraries can
only be used with programs compiled with the "same" C++ compiler, and
interfacing it with anything else requires wrapping it with an
intermediate pure C interface.
The parser is hard to write not because I have decided to "go for broke"
and provide a streaming pull-based parser, which meant implementing
some sort of coroutine-like mechanism. It turns out this is possible in
pure ANSI C without resorting to threads or stack copying, if you are
willing to resort to some nasty pre-processor stuff. This part is
thankfully done, and I began implementing the productions. Then I met
with Clark and he convinced me to factor out an "intermediate form" of
the productions so that it would be "easy" to create native
implementations of the parser in other languages. We have agreed on the
basis of such a form (YACC-like rules, using YAML syntax of course :-).
Work on the parser comes in bursts. I have spent almost no time at all
on it during the last month, but I hope to clear up some time in the
next couple of weeks and connect the "intermediate form" with the C
parser framework I have ready. Once I get that out of the way, it
should be relatively smooth going.
> I would be glad to contribute my time and effort toward such a
> parsing library, are there any other interested individuals?
There's a tricky issue with the parser that I could use help with. Given
a parser syntax description in the "intermediate form", I'd like to (1)
automatically generate a "complete" set of test cases; (2) prove/test
that there's no possible input that, fed to the parser, would cause it
to "crash". This requires some tricky combinatorical programming, and
possibly a lot of CPU cycles. Anyone interested in helping me out here?