E303 Precedence block of the wrong formΒΆ

A precedence block breaks one of its rules:

  • an alternative with fields needs an alias ->, which gives its fields a node,

  • the rule that holds the block is a plain syntactic rule, neither transparent, inlined, lexical nor a terminal,

  • the block has no parameters,

  • the block has at least one level.

start: expr
expr: %precedence {
    sum: left=atom "+" right=sum
    atom: [0-9]
}
grammar.fpeg:3:10: error[E303]: an alternative with fields needs -> in a precedence block

Give the alternative with fields an alias.

start: expr
expr: %precedence {
    sum: left=atom "+" right=sum -> add
    atom: [0-9]
}