On 04/22/2013 04:58 PM, John Clements wrote:
The rust ANTLR grammar that lives at
https://github.com/jbclements/rust-antlr/
appears to be largely correct, in the sense that it parses Rust source.
There's a problem, in that the parser is currently SO DARN SLOW that I haven't
been able to test it on the entirety of the rust repository yet. Parsing of
TTs runs at about 2K lines per second, but the full program grammar starts at
200 lines/sec, then drops to 50, and finally may simply stall out completely.
Fortunately, running fast is not the point. I've made a passing attempt to
format the grammar to be readable and to conform to certain formatting
conventions. I'd be grateful to anyone who has the time to make suggestions.
NB, for those interested: our "restriction" mechanism, as expected, makes the
rules for expression parsing much less pleasant; in particular, most of the expr
hierarchy is duplicated at least once, and some of it is duplicated three times.
Thanks for your time!
This looks amazing. Thanks. Is this grammar suitable to replace the
official grammar in the manual? Will we be able to set up some
automation around it to validate that it reflects the behavior of the
rustc parser, and to keep it up to date?
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev