Two new interfaces to Marpa
"You get to create your own world, and the only thing that limits what you can do are the capabilities of the machine -- and, more and more often they days, your own abiliites" Linus Torvalds, Just For Fun, p. 74
As of Marpa::R2 2.010000, Marpa has two new, documented, interfaces. (For those new to this blog, Marpa is something new in parsing -- it parses anything you can write in BNF and, if your grammar is in one of the classes currently in practical use, parses it in linear time. Marpa's parse engine is written in optimized C, so that Marpa's speed is competitive with parsers of far less power. Marpa's stable version is Marpa::XS.)
Announcing Marpa's C library: LibmarpaThe first new interface is Libmarpa, a C language library. Previously, Marpa's only documented interfaces required the programmer to use it through Perl. Using Marpa through Perl had major advantages -- it gave the programmer convenient access not just to Perl's capabiliites, but to all of CPAN as well.
But there were downsides.
- There are other languages besides Perl, and these have their own advantages and their own fans.
- There was a real cost in efficiency. Perhaps 90% of the time in the typical Marpa application was spent running Perl, as opposed to 10% in Marpa's C code.
- Finally, making the user interface convenient also meant making choices for the user. Not all of the capabilities of Marpa were available through Marpa::XS and Marpa::R2.
Announcing Marpa's "thin" interface: Marpa::R2::Thin
Together with Libmarpa, I am announcing a "thin" Perl interface to it. The "thin" interface is a raw interface to Libmarpa. It's a compromise between the "thick" Marpa::R2 and Marpa::XS interfaces, and having to program in C. The thin interface will be of interest to
- Programmers creating interfaces to Marpa. They no longer have to layer their code on top of Marpa::XS and Marpa::R2. All interfaces are now equal.
- Perl programmers who want direct access to all of Libmarpa's capabilities.
- Programmers in a situation which where lower overhead justifies extra effort.