最終更新日:2022/12/24
An LR(k) grammar is clearly unambiguous, since the definition implies every derivation tree must have the same handle, and by induction there is only one possible tree. It is interesting to point out furthermore that nearly every grammar which is known to be unambiguous is either an LR(k) grammar, or (dually) is a right-to-left translatable grammar, or is some grammar which is translated using both ends toward the middle.
Thus, the LR(k) condition may be regarded as the most powerful general test for nonambiguity that is now available.
編集履歴(0)
元となった例文
An
LR(k)
grammar
is
clearly
unambiguous,
since
the
definition
implies
every
derivation
tree
must
have
the
same
handle,
and
by
induction
there
is
only
one
possible
tree.
It
is
interesting
to
point
out
furthermore
that
nearly
every
grammar
which
is
known
to
be
unambiguous
is
either
an
LR(k)
grammar,
or
(dually)
is
a
right-to-left
translatable
grammar,
or
is
some
grammar
which
is
translated
using
"both
ends
toward
the
middle."
Thus,
the
LR(k)
condition
may
be
regarded
as
the
most
powerful
general
test
for
nonambiguity
that
is
now
available.