-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Parsing inconsistencies (lambda, proc, return) #28784
Comments
/cc @rust-lang/lang , can we disambiguate what's intended here? |
I agree with @rprichard's take for the most part. I guess that triage: P-medium |
Probably a good beginner bug for someone familiar with parsing. |
Make the rustc parser behavie like parser-lalr, per the op. |
I'm reaaonably familiar with parsers and I'd like to take a crack at this bug. |
@neunenak You got it! |
@nikomatsakis @nrc @pnkfelix Can you confirm the right thing to do here is make libsyntax behave like the reference parser as described in the OP? |
It's probably worth addressing any inconsistencies between the parser the reference on an individual basis. I don't have enough faith in the reference to say it is always right. My opinions on the issues in the OP: I think
agree on the last two points - bugs in the reference. |
|
@neunenak Are you still interested in this? If not, I'd like to take a stab at it. |
I'm afraid I had more trouble with it than I thought, please go ahead and
take a stab.
…On Mon, Jan 23, 2017 at 11:54 PM, Taylor Cramer ***@***.***> wrote:
@neunenak <https://github.com/neunenak> Are you still interested in this?
If not, I'd like to take a stab at it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#28784 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AATA-WBhZjRJrb3XXKr0Tq2LfLt9RJ7Xks5rVa4jgaJpZM4GG9HU>
.
|
Thanks! I took a look at the parser, and I think the issue with Edit: for context, the |
I went ahead and opened #39303 fixing Moving forward, what's left to do for this issue? Are all the rest just parser-lalr fixes? I don't think the lambda issue can be fixed backward-compatibly, can it? (Since we'd be stopping something from parsing that used to parse.) Edit: wound up making a new PR handling the remaining |
@cramertj a good question. One of my long-standing "to do" items has been to pick up work on rustypop -- in particular adding a test harness -- as a replacement for parser-lalr. When I was porting the LALR grammar, I found a number of irregularities that struck me as wrong -- often holdovers from the early days of Rust -- as well as various things whose meaning were not obvious (e.g., precedence tricks). The LALRPOP port is free of those problems. Separately, I think we have put off reaching a firm decision on a lot of these questions. This needs some organization and I think no one has had the time. I would love to find someone who would be interested in collaborating with me on one or both aspects of this project. If you are interesting, please ping me on irc ( |
@nikomatsakis Email'd you. |
…x, r=petrochenkov Fix can_begin_expr keyword behavior Partial fix for rust-lang#28784.
This seems like an interesting fix. I'll take a look at it and see what I can figure out. -- Colin |
parser-lalr has been removed in #64896. Closing in favor of the work done by the grammar working group in https://github.com/rust-lang/wg-grammar/. |
I found more inconsistencies between
rustc
andparser-lalr
.I also noticed that Rust allows return expressions and lambda expressions to end with a struct literal, even when they're in a nostruct context. This seems inconsistent to me.
Lambdas (the two parsers disagree):
Return expressions (the two parsers agree):
The
rustc
andparser-lalr
parsers disagree about whether a barereturn
expression can be cast:Finally, I also noticed these two differences, which seem much less interesting to me. The grammar is probably just out-of-date or buggy:
lambda sometimes requires braces:
proc
is obsolete:The text was updated successfully, but these errors were encountered: