Sun, 08 Jul 2012
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
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
Announcing Marpa's C library: Libmarpa
The 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.
With Libmarpa, the programmer has access to the full speed
and flexibility of Marpa's optimized C code.
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
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
- Programmers in a situation which where lower overhead
justifies extra effort.
If you are new to Marpa, you
do NOT want to head straight to the Libmarpa
and Marpa::R2::Thin documentation.
Instead, I suggest that you look at
the Marpa::R2 documentation
the Marpa web page
Libmarpa API document
is a reference manual,
which assumes that the user is already familiar with Marpa,
either through Marpa::R2, Marpa::XS or
the Marpa::R2::Thin document
in its turn, requires continual reference back
to the Libmarpa API document.
posted at: 17:31 |
direct link to this entry