Skip to content

Commit 2807cdb

Browse files
committed
Adds Pest Grammar to Ion Conversion
The purpose of this commit is the start of a tool to generate Ion formatted ASTs from Pest grammars, particularly that of PartiQL. We could then easily process the grammar outside of Rust in scripts that could be used to generate things like TextMate grammars for IDE support or LaTeX fragments for the specification document. Adds the `pestion` crate to provide a simple trait `PestToElement` and implementations over the Pest AST and `&str` syntax definitions to create Ion `Element` serialized forms. Resolves #35.
1 parent b6fa75b commit 2807cdb

File tree

5 files changed

+511
-0
lines changed

5 files changed

+511
-0
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@ members = [
66
"partiql-irgen",
77
"partiql-parser",
88
"partiql-rewriter",
9+
"pestion",
910
]

pestion/Cargo.toml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
[package]
2+
name = "pestion"
3+
authors = ["PartiQL Team <[email protected]>"]
4+
description = "A simple Pest grammar to Ion converter"
5+
homepage = "https://github.com/partiql/partiql-lang-rust/pestion"
6+
repository = "https://github.com/partiql/partiql-lang-rust/pestion"
7+
license = "Apache-2.0"
8+
readme = "README.md"
9+
keywords = ["parser", "peg", "pest", "ion", "cli"]
10+
categories = ["parser-implementations", "command-line-utilities"]
11+
exclude = [
12+
"**/.git/**",
13+
"**/.github/**",
14+
"**/.travis.yml",
15+
"**/.appveyor.yml",
16+
]
17+
edition = "2018"
18+
version = "0.0.0"
19+
20+
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
21+
22+
[dependencies]
23+
thiserror = "~1.0.25"
24+
pest = "~2.1.3"
25+
pest_meta = "~2.1.3"
26+
ion-rs = "~0.6.0"
27+
28+
[dev-dependencies]
29+
rstest = "~0.10.0"

pestion/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Pestion
2+
3+
This is a simple tool and library for converting [Pest] grammars to [Ion] data format.
4+
5+
The motivation for this is to make a portable way to introspect [Pest] grammars in other tools
6+
as a data format versus having to provide bespoke parsers for the Pest syntax in other platforms.
7+
8+
[Pest]: https://pest.rs/
9+
[Ion]: https://amzn.github.io/ion-docs/

0 commit comments

Comments
 (0)