What is Marpa?
I am very pleased to announce Marpa::R2 -- "Release 2" of the Marpa parser. For those unfamiliar, the Marpa algorithm 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, it parses it in linear time. Marpa::R2's parse engine is written in optimized C, so that Marpa::R2's speed is competitive with parsers of far less power.
An important feature of the Marpa algorithm is "situational awareness". Marpa knows at every point in the parse exactly how far it has progressed in each rule, and can share this information with the application. The advantages of this go beyond error detection -- Marpa's situational awareness is accurate, graceful and fast enough to be used as a parsing technique in its own right -- Ruby Slippers parsing.
Marpa::R2 2.006000 is alpha, and its interface is not yet frozen. Those who want a stable version of Marpa should prefer Marpa::XS. But Marpa::R2 does pass the same test suite as Marpa::XS, and at least one module has already successfully converted to Marpa::R2.
Marpa::R2 is heavily refactored internally. I expect more benefits of this refactoring to come over the next weeks, in the form of new features. Here are the new features available in this first announced release of Marpa::R2:
- Marpa::R2 is faster than Marpa::XS. The most visible speedup comes from optimizing rules and tokens whose values do not matter, so that the actual speedup varies greatly by application, but it is often 20% or more.
- Marpa::R2 no longer requires Glib. Marpa::R2 now has no non-core Perl dependency.
- Marpa::R2's internal grammar rewrites are now invisible to the user, even when tracing.
Users migrating from Marpa::XS should be aware that, while Marpa::R2's interface is similar to Marpa::XS's, it is not fully compatible. The list of incompatible changes can be found in the Marpa::R2 documentation.