This crate provides an engine that can read a compiled Enhanced Grammar Table created with the GOLD Parsing System and generate a skeleton parser in rust for your custom language.
use goldparser-rs {
engine::Builder,
parser::{GOLDParser},
vm::RuleHandler,
}
fn main() {
let parser = Builder::from("mylang.egt");
parser.load_source("test.src");
if let Ok(ast) = parser.parse() {
println!("{}",ast);
} else {
println!("Problems parsing");
}
}
For more information on how it works, see the documentation or the Wiki.
You can install the crate for use by including this in your Cargo.toml:
[dependencies]
goldparser-rs = "0.1"
......
egtutil
is a binary in the \bin directory for basic operations on compiled Enhanced Grammar Tables
and serves as a working example of implementing the parsers from this crate. The
interactive feature implements a REPL-like environment to walk through the AST of your parsed source code.
Install the goldparser-rs
crate to get the egtutil
binary.
cargo install goldparser-rs
Alternatively, you can grab it on github and make it yourself.
git clone https://github.com/droidengineer/goldparser-rs.git
cd goldparser-rs
cargo build