On 13-04-24 11:39 PM, Lindsey Kuper wrote:
On Thu, Apr 25, 2013 at 1:25 AM, Patrick Walton <[email protected]> wrote:
I have an untested grammar for Rust here,
with the token regexes not yet filled in:

https://gist.github.com/anonymous/5457664

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 LL(1).

This is really cool, but I'm sort of confused about the apparent
multiple ongoing efforts toward having a precise and machine-readable
Rust grammar.  Should we consider one of these the "real" grammar?

This is a translation of the one John just finished (which was for antlr4, a very flexible "any LL(k)" grammar) into input for yapps2, which (as far as I know) has the distinguishing features of being-in-python and being-able-to-tell-us-about-LL(1)-conflicts. I believe it's still the "same" grammar as John did, just massaged to target a different tool. At some point I'd like a library that can consume/emit the 97 different equivalent dialects of EBNF used by different tools, so we can do this sort of exercise a little more readily.

In any case that is (as far as I know) the only multiplicity of grammars floating about. The previous attempt here was one I made, targeting llnextgen, but it was abandoned mid-way-through (the results of which are currently on display in the reference manual).

Are there others?

-Graydon

_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to