Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rxwei/Parsey
Swift Parser Combinators
https://github.com/rxwei/Parsey
parser parser-combinators swift
Last synced: about 1 month ago
JSON representation
Swift Parser Combinators
- Host: GitHub
- URL: https://github.com/rxwei/Parsey
- Owner: rxwei
- License: mit
- Created: 2016-08-27T04:34:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2020-01-27T19:08:13.000Z (almost 5 years ago)
- Last Synced: 2024-10-08T19:32:36.759Z (2 months ago)
- Topics: parser, parser-combinators, swift
- Language: Swift
- Homepage:
- Size: 73.2 KB
- Stars: 58
- Watchers: 5
- Forks: 6
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- fucking-awesome-swift - Parsey - Parser combinator framework that supports source location tracking, backtracking prevention, and rich error messages. (Libs / Text)
- awesome-swift - Parsey - Parser combinator framework that supports source location tracking, backtracking prevention, and rich error messages. (Libs / Text)
- awesome-swift - Parsey - Swift Parser Combinators ` 📝 2 years ago ` (Text [🔝](#readme))
- awesome-swift - Parsey - Parser combinator framework that supports source location tracking, backtracking prevention, and rich error messages. (Libs / Text)
README
# Parsey
Swift Parser Combinator FrameworkIn addition to simple combinators, **Parsey** supports source location/range tracking,
backtracking prevention, and custom error messages.![Parsey Playground](https://pbs.twimg.com/media/CrVaoBeVYAAWWoj.jpg:large)
## Features
- Combinator interface
- `|`, `~~`, `~~>`, `<~~`, `^^` combinator operators- Lexer primitives:
- `Lexer.whitespace`, `Lexer.signedInteger`, ...- Regex-like combinators:
- Postfix `.+` for `.many()`.
- Example: `let arrayLiteral = "[" ~~> expression.+ <~~ "]"`
- Postfix `.*` for `.manyOrNone()`.
- Example: `let classDef = (attribute | method).*`
- Postfix `.?` for `.optional()`.
- Example: `let declaration = "let" ~~> id ~~ (":" ~~> type).? ~~ ("=" ~~> expression)`
- Postfix `+` for `.manyConcatenated()`.
- Example: `let skippedSpaces = (Lexer.space | Lexer.tab)+`
- Infix `+` for `.concatenatingResult(with:)`.
- Example: `let type = Lexer.upperLetter + Lexer.letter*`
- `Lexer.regex(_:)` for directly applying regular expressions.
- Example: `let id = Lexer.regex("[a-zA-Z][a-zA-Z0-9]*")`- Backtracking prevention
- `.!` postfix operator or `.nonbacktracking()`- Parser tagging for error messages
- `