Libmarpa is the C language library that implements the parse engine
at the core of Marpa.
It is used by
the Perl CPAN module,
but it is completely separate,
and resides in
its own github repo.
These instructions desribe how to install the separate Libmarpa.
Unless reading Libmarpa is your only interest,
you'll also want to install Marpa::R2.
All of Libmarpa's tests are in Marpa::R2,
and you really do not want to work with
Libmarpa without the ability to test it
on your configuration.
To install Libmarpa:
the github repo.
At the top level, make dists.
Be aware that Libmarpa requires a lot of associated software,
including Knuth's literate programming system, Cweb.
All the software is freely available and open-source,
but getting it all together
may be complicated. Sorry.
This done, there will be three very standard autotools distribution
directory at the top level:
Proceed as you would with any other standard autotools distribution directories.
- dist/, for building the library itself, and containing the code.
- doc_dist/, for building the documentation,
including a multi-page HTML version of the HTML.
for building a one-page HTML version of the documentation.
In reading and working with Libmarpa, the following documents will be useful:
- The Libmarpa API document, which is online in
The Marpa theory paper,
which has the formal description,
a proof of correctness,
and proofs of my complexity claims.
Pseudo-code for the Marpa parse engine is also included.
The code in PDF format, produced via Knuth's Cweb system.
My apologies in advance for this.
Someday it may be a book, as intended by Knuth.
For now, I use the commentary primarily to store extensive notes on the
time and speed complexity,
and on comparisons with alternative implementations.
Some sections also have comments on the actual flow of the code,
but not all.
To have a chance of understanding the code, you'll
want to be familiar with the Libmarpa API,
with Earley's algorithm,
and at least the pseudo-code in the theory paper.
Working on Libmarpa
I worked hard to limit the prerequisites needed to
configure, compile and run Libmarpa.
Working on Libmarpa's internals is another matter.
Libmarpa is literate programming --
and work on Libmarpa's internals requires,
among other things,
Knuth's CWeb and therefore Tex.
Libmarpa is highly mathematical code.
Its internals are, frankly, daunting.
For me, Marpa has a real beauty,
but nobody could claim it achieves that beauty through simplicity.
I once had hopes that reading
Marpa would be like experiencing the effortless
power of a late Picasso.
But Angkor Wat and Hieronymous Bosch show that beauty
comes in many forms.