[rust-dev] LL(1) problems

Graydon Hoare graydon at mozilla.com
Thu Apr 25 09:16:56 PDT 2013

On 13-04-25 08:33 AM, Paul Stansifer wrote:

> (For example: suppose that some statements and some expressions shared a
> common prefix that had to be merged in order to make the grammar LL(1);
> instead of having `stmt` and `expr` nonterminals in macros, we'd need to
> split them into `most_stmt` `most_expr` and `some_stmt_and_expr`.)

That would of course be undesirable. It is not clear to me that the 
factorings patrick was struggling with had that property. I think both 
suffixes of 'unsafe' were inside $stmt (branching to sub-rules shared by 
$item and $expr) and both suffixes of '&' were branching to sub-rules of 
$ty and $pat. But I might be misreading. I agree that we want to keep 
relatively pithy named entrypoints in the grammar for the macro 
nonterminal parser to hook in at (even if they're artificial). Difficult 
balancing act, but I think it may be possible. Or at least it's not 
evident to me yet that it's not.


More information about the Rust-dev mailing list