On Wed, Apr 24, 2013 at 11:04 PM, Graydon Hoare <gray...@mozilla.com> wrote:

> My skill at grammar-factoring is ... minimal, but I thought you could
> generally factor anything that's just a common-prefix situation like these
> by introducing new rules that go one (common) token further and then decide
> between the two remaining possible branches. Not to say it's pretty, but it
> ... ought to work, I think?


Please don't do this to the official parser! (I don't know if this is the
plan or not.) The structure of the AST is (indirectly) exposed to the user
by the macro system (and will be directly exposed by any procedural macro
system), and we may miss out on providing the abstractions we want to.

(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`.)

Paul
_______________________________________________
Rust-dev mailing list
Rust-dev@mozilla.org
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to