Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

Commit

Permalink
Warn people off
Browse files Browse the repository at this point in the history
  • Loading branch information
dabrahams authored Jan 20, 2025
1 parent f228b1c commit b6a6bf0
Showing 1 changed file with 5 additions and 26 deletions.
31 changes: 5 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,12 @@

[![](https://img.shields.io/endpoint?url=https%3A%2F%2Fswiftpackageindex.com%2Fapi%2Fpackages%2Fval-lang%2FLotsawa%2Fbadge%3Ftype%3Dswift-versions)](https://swiftpackageindex.com/hylo-lang/Lotsawa)

A parsing library and tool with the essential features of
[MARPA](https://jeffreykegler.github.io/Marpa-web-site/), encoded in pure Swift.
An Earley/Leo parser in pure Swift.

In particular, like MARPA, Lotsawa:
**Don't use this code.**

- Parses any [LR-regular](https://www.sciencedirect.com/science/article/pii/S0022000073800509) grammar in linear time.
- Parses some non-LR-regular grammars in linear time.
- Produces the parse forests for any CFG.
There are two faster Earley parsers, [Marpa](https://jeffreykegler.github.io/Marpa-web-site/), which inspired this work, and [YAEP](https://github.com/vnmakarov/yaep). Marpa is faster by about 1.5x but uses 10x more memory. YAEP is much faster than Marpa and uses much *much* less memory than either of the others.

Lotsawa owes almost everything of value to MARPA and its author, Jeffrey Kegler, for uncovering the
[thread of progress in parsing technology](https://jeffreykegler.github.io/personal/timeline_v3),
gathering it together into one group of algorithms, proving important properties about them, and
contributing some key innovations. This project exists primarily because MARPA is [missing
functionality](https://github.com/jeffreykegler/libmarpa/issues/117) needed by the [Hylo
language](https://github.com/hylo-lang/hylo) implementation.
Most of the code was written in a very principled way, but in January 2025 I made a lot of commits as an experiment without writing comments or tests, and now some of the tests failed.

Secondary reasons Lotsawa might be useful:

- Lotsawa supports high-level usage from a safe, statically-typed language that compiles to efficient
native code.
- Lotsawa has a simple build/installation process and no dependencies other than Swift.
- Lotsawa encodes the grammar analysis and recognition algorithms with a relatively small amount of
high-level code; it may serve as a better reference for understanding the technology than either
the highly theoretical Marpa paper or from libmarpa's C implementation, which must be extracted
from a CWeb document.
- Lotsawa can be used to precompile a grammar into static tables, eliminating some initial startup
cost.
- Lotsawa uses pure [Mutable Value
Semantics](https://www.quora.com/What-is-mutable-value-semantics/answer/Dave-Abrahams), thus
eliminating many possible sources of bugs, including data races.
You've been warned.

0 comments on commit b6a6bf0

Please # to comment.