Skip to content
A port of the Berkeley YACC parser-generator to Rust
C Rust Yacc Shell Roff DIGITAL Command Language Other
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

RACC -- Rust Another Compiler-Compiler

A port of the Berkeley YACC parser-generator to Rust

racc is a Rust procedural macro (proc-macro) that allows crates to embed LALR(1) grammars in Rust source code.

How do I use it?

Look at racc/examples/ for a brief example of how to write a grammar.

What do I do for a lexer?

nom is probably your best bet, for now.

But, why??

I've always loved yacc, and I first ported yacc to Rust as a syntax extension, years ago. This project is mostly an exercise in porting things to Rust, and seeing what the results are. If it's useful to anyone, then it's useful, and if it's not -- well, it's just anothere repo, rotting on Github, bothering no one.

Part of the exercise of this port is seeing how C idioms translate into Rust idioms. I find that porting code to Rust almost invariably clarifies the underlying algorithms, because concepts like slices and vectors much more clearly express the intent of an algorithm than C pointers do.

There are better packages out there, so just give up.

Sure, that's fine. Do whatever you want.

These packages do some or all things better than racc:


There are lots of limitations and incomplete aspects of this, unfortunately. Finding them is left an exercise to the reader.


RACC was implemented by Arlie Davis I did this as an experiment in porting a well-known (and useful) tool to Rust. I was also intrigued by Rust's support for procedural macros, and I wanted to see whether I could implement something interesting using procedural macros.


Feel free to send me any feedback on RACC to

You can’t perform that action at this time.