Skip to content

doc_grammar should also use levels for left-associativity #21029

@ia0

Description

@ia0

Camlp5 simulates left-associativity using a "recovery" mechanism. This is an implementation detail that leaks to the user documentation.

For example, the rule for Ltac sequence (which is left-associative and at level 4 in ltac_expr) should ideally be documented as:

ltac_expr4 ::= ltac_expr4 ; ltac_expr3

In Camlp5, it is implemented as (slightly abusing notations for the parallel):

ltac_expr "4" LEFTA ::= SELF ";" SELF

This has to be understood as:

ltac_expr "4" LEFTA ::= SELF ";" NEXT

But is effectively:

ltac_expr "4" LEFTA ::= NEXT ";" NEXT

It relies on the recovery mechanism to behave like SELF ";" NEXT.

Currently, this is rendered to the user as ltac_expr3 ; ltac_expr3 without explaining the recovery mechanism (there's only a pointer in the documentation of Print Grammar). As written, Ltac sequence should be non-associative, which is incorrect.

This issue is meant to discuss and (if applicable) track the effort of having doc_grammar hide the recovery mechanism (which is a Camlp5 implementation detail) by generating rules with the correct associativity using levels.

Related issues:

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: triageThe validity of this issue needs to be checked, or the issue itself updated.
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions