https://github.com/tayloraswift/swift-grammar
debuggable parsing tools for performance-sensitive libraries
https://github.com/tayloraswift/swift-grammar
grammar parsing-engine server-side-swift swift swift-package-manager
Last synced: 3 months ago
JSON representation
debuggable parsing tools for performance-sensitive libraries
- Host: GitHub
- URL: https://github.com/tayloraswift/swift-grammar
- Owner: tayloraswift
- License: apache-2.0
- Created: 2022-01-26T21:53:16.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2025-01-15T22:31:54.000Z (5 months ago)
- Last Synced: 2025-03-19T02:45:31.211Z (3 months ago)
- Topics: grammar, parsing-engine, server-side-swift, swift, swift-package-manager
- Language: Swift
- Homepage: https://swiftinit.org/docs/swift-grammar
- Size: 146 KB
- Stars: 14
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
***`grammar`***
[](https://github.com/tayloraswift/swift-grammar/actions/workflows/Tests.yml)
[](https://github.com/tayloraswift/swift-grammar/actions/workflows/Documentation.yml)High-performance constructive parsing, in pure Swift. This module powers the [`swift-json`](https://github.com/tayloraswift/swift-json) library!
**Importing this module will expose the following top-level symbols**:
* `enum Pattern`
* `enum UnicodeDigit`
* `enum UnicodeEncoding`* `protocol TraceableError`
* `protocol TraceableErrorRoot`
* `struct ParsingError`* `struct ParsingInput`
* `struct NoDiagnostics`
* `struct DefaultDiagnostics`
* `protocol ParsingDiagnostics`* `protocol ParsingRule`
* `protocol TerminalRule`
* `protocol LiteralRule`
* `protocol DigitRule`
* `protocol ASCIITerminal`
* `protocol UTF8Terminal`
* `protocol UTF16Terminal`
* `protocol UnicodeTerminal`
* `protocol CharacterTerminal`## adding `swift-grammar` as a dependency
To use `swift-grammar` in a project, add the following to your `Package.swift` file:
```swift
let package = Package(
...
dependencies: [
// other dependencies
.package(url: "https://github.com/tayloraswift/swift-grammar", from: "0.4.0"),
],
targets: [
.target(name: "example",
dependencies: [
.product(name: "Grammar", package: "swift-grammar"),
// other dependencies
]),
// other targets
]
)
```## Requirements
The swift-grammar library requires Swift 5.8 or later.
| Platform | Status |
| -------- | ------ |
| 🐧 Linux | [](https://github.com/tayloraswift/swift-grammar/actions/workflows/Tests.yml) |
| 🍏 Darwin | [](https://github.com/tayloraswift/swift-grammar/actions/workflows/Tests.yml) |
| 🍏 Darwin (iOS) | [](https://github.com/tayloraswift/swift-grammar/actions/workflows/iOS.yml) |
| 🍏 Darwin (tvOS) | [](https://github.com/tayloraswift/swift-grammar/actions/workflows/tvOS.yml) |
| 🍏 Darwin (visionOS) | [](https://github.com/tayloraswift/swift-grammar/actions/workflows/visionOS.yml) |
| 🍏 Darwin (watchOS) | [](https://github.com/tayloraswift/swift-grammar/actions/workflows/watchOS.yml) |