Skip to content

Should we avoid mixing left-recursive and right-recursive grammar productions? #3835

@gibson042

Description

@gibson042

I haven't checked the syntactic grammar, but our lexical(-ish) grammars seem to freely mix left- and right-recursion, sometimes in the same section.

Left-recursive

Right-recursive

This is fine in a strict sense, but seems to add unnecessary friction—for comprehension, and likely also for implementation. I'd like to take a stance and ideally enforce it programatically, first for the above and then possibly also for syntactic grammars (keeping in mind potential interaction with [empty] and also production-ordering disambiguation, at least until the latter is resolved by e.g. #1727 and #2445).

That said, I'd like to know if spec consumers have reason to prefer one convention over the other.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions