I've been a long time lurker ever since watching the
FLOSS Weekly interview with Andrew Rodland. I have always been curious about parsing and decided to try and implement the algorithm in c#. I'd like to thank the community for being so open with documentation and implementation detail as it has been great in doing research in the implementation.
During parse tree creation, I ended up getting stuck on recreating the parse forest for leo items.
Posting on
stackoverflow got the attention of Jeffrey who led me to a solution with his comment on some marpa documentation. I actually implemented the sparsely packed parse forest using leo items directly and thought this implementation may be of interest. Jeffrey mentioned that using leo semantics may be too complicated, but it turned out to be fairly straightforward. I look at leo items like chains that form the right spine of a SPPF tree. The SPPF is implemented using
Elizabeth Scott's algorithm. Virtual nodes help in keeping the recognition time O(n), and during creation top of the leo chain is passed into the virtual node. A index pointer to the top of the chain is passed from leo item to leo item during the optimization phase, forward pointers are maintained when returning from the recursive leo optimization.
I think the implementation is at a point where I'm ready to let the marpa community see it and give some critique.
Here is the github repo. It still needs a lot of work, but I'm pretty sure the SPPF with leo items is working properly. If there are any test cases that you know are particularly challenging for the marpa parser, I'd be interested in implementing them to make sure my implementation is correct.