[rust-dev] LL(1) problems
pwalton at mozilla.com
Wed Apr 24 22:25:13 PDT 2013
On 4/24/13 8:04 PM, Graydon Hoare 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?
I tried harder to refactor it. I have an untested grammar for Rust here,
with the token regexes not yet filled in:
yapps2 reports that this grammar is LL(1).
Note that the refactorings I made resulted in a grammar which isn't that
great for tooling or parsing in many places. In particular the
contortions needed to make `self_ty_and_maybenamed_args` result in an
AST that combines the self type and the type of the first argument
together in bizarre ways.
Since this is untested, I'm sure there are bugs, but it's probably a
good sign that I could at least refactor the grammar to what I think is
More information about the Rust-dev