-
Notifications
You must be signed in to change notification settings - Fork 0
How To Use
B. Gian James edited this page Feb 3, 2023
·
3 revisions
Instructions on using this crate in your projects. This assumes you have an EGT created by running your grammar through the builder. Instructions on doing that can be found here.
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
Generate your Rust LLAR parser from your grammar table:
>goldprog <EGT> <Rust Template> [Target File]
goldprog lang.egt ./template/rust parser.rs
This will generate a skeleton parser called parser.rs. It is in this generated parser that you will place your custom code for the rules in your language. This rust file goes in your project.
Edit Cargo.toml:
[dependencies]
...
goldparser-rs = "0.1"
In your code:
Grab this repository:
git clone https://github.com/droidengineer/goldparser-rs.git