https://github.com/sameer/g-code
G-Code Parser written in Rust using Peg
https://github.com/sameer/g-code
Last synced: 10 months ago
JSON representation
G-Code Parser written in Rust using Peg
- Host: GitHub
- URL: https://github.com/sameer/g-code
- Owner: sameer
- License: other
- Created: 2021-01-21T06:17:09.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2024-09-09T01:28:10.000Z (over 1 year ago)
- Last Synced: 2025-04-02T11:54:18.886Z (11 months ago)
- Language: G-code
- Homepage:
- Size: 4.09 MB
- Stars: 13
- Watchers: 4
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# g-code
[](https://crates.io/crates/g-code) [](https://docs.rs/g-code)  [](https://codecov.io/gh/sameer/g-code)
A joint crate for g-code parsing and emission.
## Parsing
The parser is written in Rust using [peg](https://github.com/kevinmehall/rust-peg).
### Demo
```
cargo run --example parse ./tests/vandy_commodores_logo.gcode
```
Output: https://gist.github.com/sameer/5fe20dad6faa6329926df48b82e68581
## Emission
Basic primitives for g-code emission.
Supports formatting, checksum and line number generation.
### Demo
See [svg2gcode](https://github.com/sameer/svg2gcode).
## TODOs
### Parse
* [ ] g-code parameters
* [ ] g-code infix notation
### Emit
* [ ] Remaining commonly-used commands (open an issue or create a PR if you need one that's missing)
## References
* https://www.reprap.org/wiki/G-code
* NIST Interpreter: https://tsapps.nist.gov/publication/get_pdf.cfm?pub_id=823374
* https://en.wikipedia.org/wiki/G-code