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:
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:In Camlp5, it is implemented as (slightly abusing notations for the parallel):
This has to be understood as:
But is effectively:
It relies on the recovery mechanism to behave like
SELF ";" NEXT.Currently, this is rendered to the user as
ltac_expr3 ; ltac_expr3without explaining the recovery mechanism (there's only a pointer in the documentation ofPrint 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_grammarhide the recovery mechanism (which is a Camlp5 implementation detail) by generating rules with the correct associativity using levels.Related issues:
doc_grammar. #16652