An ANTLR grammar for Rust
The ANTLR grammar works in two modes. First, it can parse whole files as sequences of "token trees". Second, it can parse them as Rust programs. It's not worth getting into the differences here; suffice it to say that parsing as token trees essentially just tests the lexer, and makes sure that the delimiters match.
The token-tree parsing appears to successfully parse all readily-available Rust code.
The full parser also appears to parse all readily-available Rust code, although it's SO SLOW that I'm having trouble checking.
To try it out:
makejava org.antlr.v4.runtime.misc.TestRig Rust tts -encoding UTF-8 < foo.rsor, if you want to parse using the full program parser, replace this last line with
java org.antlr.v4.runtime.misc.TestRig Rust prog -encoding UTF-8 < foo.rsThis generates no output on success, and error output on failure.
If you want to see the tree produced by the parser, you can pass the "-tree" argument.
This work is licensed under the Apache License, version 2.0
96 commits
ANTLR
77.1%
Racket
22.5%
An ANTLR grammar for Rust
The ANTLR grammar works in two modes. First, it can parse whole files as sequences of "token trees". Second, it can parse them as Rust programs. It's not worth getting into the differences here; suffice it to say that parsing as token trees essentially just tests the lexer, and makes sure that the delimiters match.
The token-tree parsing appears to successfully parse all readily-available Rust code.
The full parser also appears to parse all readily-available Rust code, although it's SO SLOW that I'm having trouble checking.
To try it out:
makejava org.antlr.v4.runtime.misc.TestRig Rust tts -encoding UTF-8 < foo.rsor, if you want to parse using the full program parser, replace this last line with
java org.antlr.v4.runtime.misc.TestRig Rust prog -encoding UTF-8 < foo.rsThis generates no output on success, and error output on failure.
If you want to see the tree produced by the parser, you can pass the "-tree" argument.
This work is licensed under the Apache License, version 2.0
96 commits
ANTLR
77.1%
Racket
22.5%