Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.
Sign upGrammar tests #2234
Comments
This comment has been minimized.
This comment has been minimized.
|
How many negative parsing tests do we have? I'm guessing not many... but we |
This comment has been minimized.
This comment has been minimized.
|
I also would assume that coverage of failure cases in the parser is not great, so we could kill two birds with one stone. |
This comment has been minimized.
This comment has been minimized.
|
Speaking of coverage, today I realized that #690 is unblocked. It might be possible for us to measure test coverage. |
This comment has been minimized.
This comment has been minimized.
|
Antlr is a possibility but I think it is willing to handle a lot more grammar ambiguity, and it tends to blur lexing and parsing rules. I want us to remain in the classical regular-lexing + LL(1)-parsing space. I picked the EBNF in the manual for compatibility with llnextgen, http://os.ghalkes.nl/LLnextgen/ ; I got part way into wiring up the rules for extracting and testing the grammar but didn't finish in time for 0.1, haven't come back to it yet. Lexical rules I figured we could feed to quex http://quex.sourceforge.net/ but other possibilities exist. It just seems like the current leader in the space we're interested in. |
This comment has been minimized.
This comment has been minimized.
|
We can use the fuzzer to find arbitrary numbers of random samples to feed to both parsers. |
This comment has been minimized.
This comment has been minimized.
|
good idea... |
This comment has been minimized.
This comment has been minimized.
|
nominating for well-defined |
This comment has been minimized.
This comment has been minimized.
|
Still relevant |
This comment has been minimized.
This comment has been minimized.
|
I had a look at this issue and started working on a parser using Flex and LLnextgen (https://github.com/fhahn/rust-grammer). Right now, the parser supports only a tiny tiny bit of the Rust grammer, but I wanted to make sure my approach is valid, before continuing. One main difference to the grammer specification in the documentation is that flex uses regular expressions for token definitions, not ebnf, so I started converting the ebnf from section 3 "Lexical structure" to regular expressions for flex. |
This comment has been minimized.
This comment has been minimized.
|
Note that grammar in the manual is highly likely to be incorrect (which is presumably exactly what this issue is aiming to address). |
This comment has been minimized.
This comment has been minimized.
|
Note that someone already completed an grammar months ago, it just never got used for anything yet. No idea where to find it though. |
This comment has been minimized.
This comment has been minimized.
|
https://github.com/jbclements/rust-antlr To the best of his knowledge, it was correct at the time. On Sun, Sep 15, 2013 at 9:20 AM, Marvin Löbel notifications@github.comwrote:
|
This comment has been minimized.
This comment has been minimized.
|
I found a extract_grammer.py script in So far, I stumbled over one part of the grammer where I think the productions in the
But I think ignoring comments should be done in the lexer, so this wouldn't be a problem for the Rust grammer being LL(1). |
This comment has been minimized.
This comment has been minimized.
|
@fhahn Again, the grammar fragments in the manual are useless, what should actually be done is
But thanks for showing interest for this work. :) |
This comment has been minimized.
This comment has been minimized.
|
What's the preferred parser generator? |
This comment has been minimized.
This comment has been minimized.
|
@fhahn use whatever you're comfortable with, is my suggestion. |
This comment has been minimized.
This comment has been minimized.
|
I'm still very keen to make this happen for 1.0. There is existing infrastructure in the tree for testing the manual's grammer with llnextgen. |
This comment has been minimized.
This comment has been minimized.
|
I agree, this would be very valuable. Especially when we get automated testing working. |
This comment has been minimized.
This comment has been minimized.
|
I'm working on updating rust-antlr. |
This comment has been minimized.
This comment has been minimized.
|
I've made some good progress on an LLnextgen-capable grammar at https://github.com/bleibig/rust-grammar. There's still a ways to go, but once it's done it shouldn't be hard to integrate the grammar into the manual and have the grammar tests work with that. |
This comment has been minimized.
This comment has been minimized.
|
Nominating. I want to have confidence in our grammar. |
brson
added
the
I-nominated
label
Apr 15, 2014
This comment has been minimized.
This comment has been minimized.
|
leaving as P-high. We really would like to have a formal definition of our grammar and have it tested, but we do not think it should be a blocker for 1.0 at this time. Cc'ing @cmr since he is working on grammar stuff. |
pnkfelix
removed
the
I-nominated
label
Apr 17, 2014
This comment has been minimized.
This comment has been minimized.
Arcnor
commented
Jun 4, 2014
|
@cmr did you end up updating rust-antlr? I wanted to have some sort of IDE support for Rust, and having an existing ANTLR grammar will make that happen a lot faster. |
This comment has been minimized.
This comment has been minimized.
|
@Arcnor actively working on it. |
bleibig
referenced this issue
Jan 21, 2015
Merged
Add a LALR grammar for Rust with testing support #21452
This comment has been minimized.
This comment has been minimized.
|
Was going to move to the RFC repo, but let's see how #21452 shakes out. |
bors
added a commit
that referenced
this issue
Jan 24, 2015
This comment has been minimized.
This comment has been minimized.
|
#21452 added |
brson commentedApr 17, 2012
It would be nice to have confidence about what sort of grammar Rust has. One possible way we could do that: