Which Marpa distribution to use?

Which distribution of Marpa should you use? Marpa::XS or Marpa::PP or the "bare name" Marpa? Use Marpa::XS if you can, Marpa::PP otherwise. The "bare name" Marpa is a legacy distribution, and should be avoided by new users and in new implementations.


Marpa::XS incorporates all of my C language speedups. As well as the fastest of the Marpa distributions, it is also the only one in beta -- in particular, I will be at pains to keep the interface stable. Marpa::XS is best both for the casually curious, and for those intending to use the Marpa algorithm in their applications. Note that since Marpa::XS remains beta, caution is still advised.

Marpa::XS DOES require a C compiler, as well as glib and a few other GNU prerequisites. To run and install Marpa::XS and its documentation, you DO NOT need POSIX, glibc, gcc or TeX.


If you can't install Marpa::XS, the other choice is Marpa::PP. Marpa::PP is Pure Perl; it has most of the features of Marpa::XS; and it has fewer prerequisities. But Marpa::PP remains in alpha; it is 5 times slower than Marpa::XS; and it will have a lower priority for bug fixes.

"Bare name" Marpa

The "bare name" Marpa distribution is a legacy. If you are new to Marpa, please do not use it. I leave it on CPAN only as a service to Marpa's past users. If I could remove it without impacting them, I would.


  1. "POSIX": In theory, Marpa::XS runs on Windows. I say "in theory" because while all of Marpa::XS's prerequisites run on Windows, to my knowledge nobody has ever assembled them and actually run Marpa::XS on Windows. I am not "anti-Microsoft", but I do not at this moment have access to a Windows machine.
  2. "glib and glibc": It's easy to confuse glib and glibc. Both are GNU libraries. glibc is GNU's C standard library, which implements parts of POSIX and requires others. Marpa::XS does NOT require glibc or POSIX.

    glib, on the other hand, is GNU's cross-platform software utility library. Marpa::XS DOES require glib. glib does NOT require UNIX, POSIX, or glibc. glib is not tiny, but the alternative to Marpa::XS's use of glib would be my attempt at a portable reimplementation of those parts of it that Marpa::XS uses. For the moment, glib is the safest and easiest way to go.

  3. "gcc": Marpa::XS's C code consists of its core library (libmarpa) and an XS wrapper. The XS wrapper compiles with any compiler which compiles Perl. libmarpa compiles clean with the -ansi and -pedantic flags and therefore any C89 compiler should work.

  4. "TeX": If you poke into the subdirectories, you may be alarmed to see places where TeX and/or CWeb is used. No TeX or CWeb is required to install or run Marpa::XS or its documentation. They are for DEVELOPMENT ONLY. In fact, if you plan on hacking the Perl interface code, or even the XS wrapper, you still don't need to have TeX and CWeb on your system. It is only the highly mathematical core of Marpa, libmarpa, that uses CWeb and therefore TeX. If you look at the libmarpa code, I think you'll see that, when it came to documenting libmarpa, POD, C comments, and man pages were simply not going to be enough to do the job.


why not do something similar to JSON? using Marpa would use Marpa::XS if available, and fall back to Marpa::PP otherwise.

Yes, I came here to make the same comment, only using CSV as an example.

I'd recommend planning to deprecate the current bare-name Marpa in favor of a future portable version of Marpa::XS and Marpa::PP (the fallback strategy outlined above sounds good!) Note that searching "marpa perl" on Google yields the bare-name version as the first hit. This is too prime a territory to cede for a very small set of users (who are perfectly able to stay on with whatever version currently exists, or to fork that version for whatever bug fixes they desire.)

I'm taking a look through the Marpa::XS source code and it looks very amenable to running on Windows. I'll see if I can get it up and going in Strawberry Perl soon.

I always just assumed that "Marpa" included Marpa::PP, but if just plain "Marpa" is some old, deprecated, unsupported code, I would recommend at the very least that you upload a new legacy "Marpa" release that tells everyone in its POD that its been deprecated in favor of Marpa::XS or Marpa::PP.

Hi Jeffrey

If "Marpa::XS and Marpa::PP are not interface-compatible with it." is there a doc which explains the code patches required to move from Marpa to those other 2.


About Jeffrey Kegler

user-pic I blog about Perl, with a focus on parsing and Marpa, my parsing algorithm based on Jay Earley's.