rust/src/grammar/README.md

21 lines
555 B
Markdown
Raw Normal View History

2014-07-14 03:52:18 -05:00
Reference grammar.
Uses [antlr4](http://www.antlr.org/) and a custom Rust tool to compare
2014-12-30 09:49:27 -06:00
ASTs/token streams generated. You can use the `check-lexer` make target to
2014-07-21 21:26:20 -05:00
run all of the available tests.
2014-07-14 03:52:18 -05:00
2014-07-21 21:26:20 -05:00
To use manually:
2014-07-14 03:52:18 -05:00
```
antlr4 RustLexer.g4
javac *.java
rustc -O verify.rs
for file in ../*/**.rs; do
echo $file;
2014-12-30 09:49:27 -06:00
grun RustLexer tokens -tokens < $file | ./verify $file RustLexer.tokens || break
2014-07-14 03:52:18 -05:00
done
```
Note That the `../*/**.rs` glob will match every `*.rs` file in the above
directory and all of its recursive children. This is a zsh extension.