How is ambiguity defined?

Apologies for what may be a naive question.

Consider this grammar:

lnnl: "a", number, number, "a" .
-number: oddnumber ; evennumber .
-oddnumber: "1" ; .
-evennumber: "2" ; .

The grammar is ambiguous in that there are multiple nonterminals that
can match nothing.

But there is only one possible parse for “a12a”. I assume that we don’t
report any ambiguity in this case.

There are several possible parses for “aa”, but they’ll all produce
exactly the same XML serialization. Does that count as ambiguous?

                                        Be seeing you,
                                          norm

--
Norm Tovey-Walsh
Saxonica

Received on Wednesday, 5 January 2022 12:41:34 UTC