https://github.com/Subtlesplendor/realm-parser
A port of Elm's Parser library to Roc, empowered by Roc's type system
https://github.com/Subtlesplendor/realm-parser
Last synced: 12 days ago
JSON representation
A port of Elm's Parser library to Roc, empowered by Roc's type system
- Host: GitHub
- URL: https://github.com/Subtlesplendor/realm-parser
- Owner: Subtlesplendor
- Created: 2023-03-07T11:56:37.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-01-03T19:45:57.000Z (5 months ago)
- Last Synced: 2025-01-03T20:26:34.912Z (5 months ago)
- Language: Roc
- Homepage: https://www.roc-lang.org/
- Size: 8.45 MB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- roc-awesome - Subtlesplendor/roc-parser
README
# realm-parser
A port of Elm's Parser library to Roc, empowered by Roc's type system. https://www.roc-lang.org/If you are interested in a generic Roc parser library, see also [roc-parser](https://github.com/lukewilliamboswell/roc-parser), maintained by [Luke Boswell](https://github.com/lukewilliamboswell), which is easier to use, more stable and as been more thoroughly tested than this package.
## Structure
The most advanced parser is Advanced.Generic.Parser. It is as general as possible, and has as much functionality as possible.To get started I would instead recommend to use the UTF8 or Bytes parser.
## This is a work in progress
I am currently experimenting with using this as a UTF8 parser for lexing/parsing in the frontend of a compiler. I expect things to change due to this usage. Will need to add some more tests as well.The exposed quantities in the UTF8 parser is in particular likely to change, as I am refactoring it a bit.
## Differences to the Elm parser
This parser library works for parsing generic lists, not just strings. This means that some of the concepts of the Elm parser do not carry over. So the parsers now do not keep track of row, column, or indent --- because those do not make sense for arbitrary lists.A slight complication is hence that to generate a nice error message that refers to e.g. a row and column requires a second pass through of the source to determine these quantities at the location of the error.